/* General body and font styling */
:root {
    --brand-color: #4338ca;
    --brand-color-hover: #312e81;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --white: #fff;
    --red: #ef4444;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent scrolling */
    display: grid;
    grid-template-rows: 1fr auto;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "main sidebar"
        "footer sidebar";
    height: 100vh;
    background-color: var(--gray-100);
}

#canvas-container {
    grid-area: main;
    position: relative;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ebebeb;-
    padding: 1rem; /* Add space around the paper */
   /*padding-bottom: 1rem;
    padding-left: 12rem;
    padding-right: 12rem;*/
    box-sizing: border-box; /* Ensure padding is included in size calculation */
}

/* Active tool button styling */
.active-tool {
    background-color: var(--brand-color) !important;
    color: var(--white) !important;
}

/* Full-screen canvas */
#myCanvas {
    background-color: rgb(255, 255, 255);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border: 2px solid #cbd5e0; /* Added a subtle border */
    padding: 0.15rem; */ /* REMOVED: Margin is now handled by container padding */
    touch-action: none; /* Prevent default touch actions like scroll/zoom */
}

/* Floating top menu */
#topBar {
    position: fixed;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background-color: rgba(13, 13, 13, 0.8);
    backdrop-filter: blur(8px);
}

/* Dropdown container */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 0.5rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-content button {
    width: 100%;
    margin-bottom: 0.25rem;
}

#ellipseTool span {
     display: inline-block;
     transform: scaleX(1.5);
}

/* Custom context menu styles for right-click actions */
#customContextMenu {
    position: absolute;
    background-color: var(--white);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 0.5rem;
    z-index: 1000;
    display: none;
}

.context-menu-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-800);
}

.context-menu-item:hover {
    background-color: var(--gray-100);
}

.context-menu-item.danger {
    color: var(--red);
}
.context-menu-item.danger:hover {
     background-color: #fee2e2;
}

/* Generic Modal Styling */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: none;
    flex-direction: column;
    width: 280px;
}

.modal-content input,
.modal-content select {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    width: 100%;
    margin-bottom: 1rem;
    font-size: 1rem;
    outline: none;
}

.modal-content label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.button-group {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.modal-button {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 600;
    transition: background-color 200ms;
}

.modal-button.ok {
    background-color: var(--brand-color);
    color: var(--white);
    border: none;
}

.modal-button.ok:hover {
    background-color: var(--brand-color-hover);
}

.modal-button.cancel {
    background-color: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.modal-button.cancel:hover {
    background-color: var(--gray-200);
}

/* Shape Inspector Panel */
#shapeInspectorPanel {
    width: 220px; /* More compact width */
    z-index: 2000;
    cursor: move;
    padding: 0; /* Remove default modal padding to have more control */
}

#inspectorHeader {
    padding: 0.5rem 0.75rem; /* Compact padding */
    font-size: 0.875rem; /* Smaller font */
    background-color: var(--gray-100);
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
    font-weight: 600;
    border-bottom: 1px solid var(--gray-300);
}

#shapeInspectorPanel .modal-content {
     padding: 0.75rem;
     display: flex;
     flex-direction: column;
     gap: 0.5rem;
}

/* MODIFICATIONS FOR COMPACT PANELS */
.inspector-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#shapeInspectorPanel .modal-content label {
    margin-bottom: 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-700);
}
#shapeInspectorPanel .modal-content input,
#shapeInspectorPanel .modal-content select {
    width: 110px;
    padding: 0.25rem;
    font-size: 0.75rem;
    margin-bottom: 0;
}
#shapeInspectorPanel .modal-content input[type="color"] {
    padding: 0;
    height: 24px;
}
#shapeInspectorPanel .button-group {
    margin-top: 0.5rem;
    padding: 0 0.75rem 0.75rem; /* Add padding here instead of the main modal div */
}
#shapeInspectorPanel .modal-button {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

/* Edit Dimension Modal COMPACT STYLES */
#editDimensionModal {
    width: 240px;
    padding: 1rem;
    cursor: move;
}
#editDimensionModal h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
#editDimensionModal .modal-content label {
    font-size: 0.875rem;
}
#editDimensionModal .modal-content input {
    padding: 0.375rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}
#editDimensionModal .button-group {
    margin-top: 0.5rem;
}
#editDimensionModal .modal-button {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}
