/* Excel Trainer Styles */

.trainer-grid-container {
    overflow: auto;
    max-height: 500px;
    border: 1px solid var(--border-color);
}

.trainer-grid {
    min-width: 100%;
}

.trainer-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.trainer-table th,
.trainer-table td {
    border: 1px solid #d0d7de;
    padding: 4px 8px;
    text-align: left;
    white-space: nowrap;
    min-width: 80px;
    height: 28px;
}

.trainer-table thead th {
    background: linear-gradient(to bottom, #f6f8fa, #eaeef2);
    color: #57606a;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: center;
}

.trainer-table th.col-header {
    min-width: 80px;
}

.trainer-table th.row-header {
    background: linear-gradient(to right, #f6f8fa, #eaeef2);
    color: #57606a;
    font-weight: 600;
    text-align: center;
    min-width: 40px;
    position: sticky;
    left: 0;
    z-index: 5;
}

.trainer-cell {
    background: #fff;
    cursor: cell;
    transition: background-color 0.1s;
}

.trainer-cell:hover {
    background-color: #f0f6fc;
}

.trainer-cell.selected {
    background-color: #ddf4ff !important;
    outline: 2px solid #0969da;
    outline-offset: -2px;
}

.trainer-cell.correct {
    background-color: #d1f7c4 !important;
}

.trainer-cell.incorrect {
    background-color: #ffd7d7 !important;
}

.trainer-cell.editing {
    padding: 0;
}

.trainer-cell input {
    width: 100%;
    height: 100%;
    border: none;
    padding: 4px 8px;
    font-size: inherit;
    font-family: inherit;
    background: transparent;
}

.trainer-cell input:focus {
    outline: none;
}

/* Formula Bar */
.trainer-formula-bar {
    background: #f6f8fa;
    border-bottom: 1px solid #d0d7de;
}

.trainer-cell-ref {
    font-family: 'Consolas', monospace;
    font-size: 12px;
    min-width: 50px;
    text-align: center;
}

/* Task Panel */
.trainer-task-panel {
    border-radius: 0;
    border-left: 4px solid var(--excel-green);
}

/* Result Panel */
.trainer-result-panel {
    border-top: 2px solid var(--border-color);
}

/* Toolbar */
.trainer-toolbar {
    border-bottom: 1px solid #d0d7de;
}

/* Cell Formatting */
.trainer-cell.bold {
    font-weight: bold;
}

.trainer-cell.italic {
    font-style: italic;
}

.trainer-cell.underline {
    text-decoration: underline;
}

/* Frozen Panes */
.trainer-table .frozen-row {
    position: sticky;
    top: 28px;
    z-index: 9;
    background: #fff;
    border-bottom: 2px solid #0969da;
}

.trainer-table .frozen-col {
    position: sticky;
    left: 40px;
    z-index: 4;
    background: #fff;
    border-right: 2px solid #0969da;
}

/* Conditional Formatting Classes */
.cf-green {
    background-color: #c6efce !important;
    color: #006100;
}

.cf-yellow {
    background-color: #ffeb9c !important;
    color: #9c5700;
}

.cf-red {
    background-color: #ffc7ce !important;
    color: #9c0006;
}

/* Loading State */
.trainer-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Hint Text */
.hint-text {
    font-size: 0.9rem;
    padding: 8px 12px;
    background: rgba(13, 202, 240, 0.1);
    border-radius: 4px;
    margin-top: 8px;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .trainer-table th,
    .trainer-table td {
        min-width: 60px;
        padding: 2px 4px;
        font-size: 12px;
    }
    
    .trainer-grid-container {
        max-height: 350px;
    }
    
    .trainer-formula-bar {
        flex-wrap: wrap;
    }
    
    .trainer-formula-bar input {
        width: 100%;
        margin-top: 8px;
    }
}

/* Print Styles */
@media print {
    .trainer-toolbar,
    .trainer-formula-bar,
    .trainer-result-panel {
        display: none;
    }
    
    .trainer-grid-container {
        max-height: none;
        overflow: visible;
    }
}
