/* ===== MAIN LAYOUT STYLES ===== */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 20px; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
}

/* Main tool interface styling (for index.php) */
body.tool-interface {
    background: #f5f5f5;
    margin: 0;
    padding: 10px;
}

body.tool-interface h1 {
    color: #333;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* ===== TYPOGRAPHY ===== */
h1 { 
    color: #667eea; 
    text-align: center; 
    border-bottom: 3px solid #667eea; 
    padding-bottom: 10px;
    margin-bottom: 30px;
    font-size: 1.5em;
}

h2 { 
    color: #764ba2; 
    border-left: 4px solid #764ba2; 
    padding-left: 15px;
    margin-top: 30px;
}

h3 { 
    color: #555; 
    margin-top: 25px;
}

/* ===== TOOLBAR STYLES ===== */
#toolbar {
    margin-bottom: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#toolbar button {
    font-size: 14px;
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px solid #ccc;
    cursor: pointer;
    min-width: 60px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#toolbar button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#toolbar button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ===== DROPDOWN STYLES ===== */
.draw-dropdown {
    position: relative;
    display: inline-block;
}

.draw-dropdown-btn {
    background-color: white;
    color: black;
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px solid #ccc;
    cursor: pointer;
    min-width: 80px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.draw-dropdown-btn:hover {
    background-color: #f8f8f8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.draw-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: 1000;
    border-radius: 6px;
    border: 1px solid #ddd;
    top: 100%;
    left: 0;
    margin-top: 2px;
}

.dropdown-item {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 4px;
    margin: 2px;
}

.dropdown-item:hover {
    background-color: #f1f1f1;
}

/* ===== COLOR INDICATORS ===== */
.color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 10px;
    border: 1px solid #ccc;
    display: inline-block;
    flex-shrink: 0;
}

/* Remove borders from specific icons */
.color-indicator[style*="background-color: rgba(255, 255, 255, 1)"] {
    border: none !important;
}

.color-indicator[style*="background-color: #eef7ff"] {
    border: none !important;
}

/* Custom Via icon styling */
.via-icon {
    position: relative;
    background-color: rgba(0, 0, 0, 0.3) !important;
    border: 2px solid #000 !important;
}

.via-icon::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 2px;
    background: #000;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.via-icon::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 2px;
    background: #000;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* ===== MODAL STYLES ===== */
.layer-modal {
    position: absolute;
    background: #fff;
    border: 1px solid #000;
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
    z-index: 1000;
    user-select: none;
}

.layer-modal.hidden { 
    display: none; 
}

.layer-modal .modal-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f7f7f7;
    border-bottom: 1px solid #ddd;
    cursor: grab;
    font-weight: bold;
}

.assignment-modal {
    position: fixed;
    background: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 1001;
    user-select: none;
    width: 75vw;
    min-width: 400px;
    max-width: 800px;
    min-height: 300px;
    max-height: 80vh;
    resize: both;
    overflow: auto;
}

.assignment-modal.hidden { 
    display: none; 
}

.assignment-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 10px 15px;
    background: #f0f8ff;
    border-bottom: 1px solid #ddd;
    cursor: grab;
    font-weight: bold;
    border-radius: 6px 6px 0 0;
}

.assignment-modal .modal-content {
    padding: 20px;
    overflow-y: auto;
    height: calc(100% - 50px);
    user-select: text;
}

.assignment-modal .close-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.assignment-modal .close-btn:hover {
    color: #000;
    background: #f0f0f0;
    border-radius: 3px;
}

/* ===== COMMAND LINE INTERFACE ===== */
.command-line {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #2c3e50;
    color: white;
    padding: 15px 20px;
    border-top: 2px solid #3498db;
    z-index: 1000;
}

.command-line input {
    width: 100%;
    background-color: #34495e;
    color: #ecf0f1;
    border: 1px solid #7f8c8d;
    padding: 10px 15px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    margin-bottom: 8px;
}

.command-line input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.command-line input::placeholder {
    color: #95a5a6;
}

.status {
    font-size: 12px;
    color: #bdc3c7;
    font-family: 'Courier New', monospace;
}

/* Adjust canvas container to make room for command line */
#canvasContainer {
    margin-bottom: 100px;
}

/* ===== DOCUMENTATION STYLES ===== */
.command-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    border-left: 4px solid #667eea;
}

.example {
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
}

.layer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.layer-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.layer-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin: 0 auto 8px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tip {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    border-left: 4px solid #ffc107;
}

.warning {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    border-left: 4px solid #dc3545;
}

.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    border-left: 4px solid #17a2b8;
}

code {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #d73a49;
}

.btn {
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin: 5px;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: #5a6fd8;
}
