/* =================================================================
   DECK BUILDER - BASE LAYOUT STYLES
   Split from deck-builder.css for maintainability
   Contains: Core layout, header, controls, summary, table, badges
   ================================================================= */

.module-deck-builder {
    max-width: 100%;
    width: 100%;
    padding: 20px;
}

/* Deck Header */
.deck-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.deck-title h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.deck-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.deck-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Deck Controls */
.deck-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 12px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group.search-group {
    flex: 1;
    min-width: 150px;
}

.filter-group.search-group input {
    flex: 1;
    max-width: 300px;
}

.stats-mini {
    margin-left: auto;
    display: flex;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.unsaved-indicator {
    background: var(--warning);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
}

.unsaved-indicator.hidden {
    display: none;
}

/* Deck Summary */
.deck-summary {
    background: #ecf0f1;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

[data-theme="dark"] .deck-summary {
    background: var(--bg-secondary);
}

.deck-summary .summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.deck-summary .stat-box {
    background: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #3498db;
}

[data-theme="dark"] .deck-summary .stat-box {
    background: var(--bg-primary);
}

.deck-summary .stat-box .number {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
}

[data-theme="dark"] .deck-summary .stat-box .number {
    color: var(--primary);
}

.deck-summary .stat-box .label {
    color: #7f8c8d;
    font-size: 14px;
    margin-top: 5px;
}

[data-theme="dark"] .deck-summary .stat-box .label {
    color: var(--text-secondary);
}

/* Deck Legend */
.deck-legend {
    margin: 16px 0;
    padding: 12px;
    background: #ecf0f1;
    border-radius: 6px;
    font-size: 13px;
}

[data-theme="dark"] .deck-legend {
    background: var(--bg-secondary);
}

.deck-legend strong {
    color: var(--text-primary);
    margin-right: 12px;
}

.deck-legend .legend-item {
    display: inline-block;
    margin-right: 16px;
    margin-bottom: 8px;
}

/* Deck Table Container */
.deck-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-height: 600px;
    overflow: scroll;
    scrollbar-width: auto;
    scrollbar-color: #888 #f1f1f1;
}

/* Custom scrollbar styling */
.deck-table-container::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.deck-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 7px;
}

.deck-table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 7px;
    border: 2px solid #f1f1f1;
}

.deck-table-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.deck-table-container::-webkit-scrollbar-corner {
    background: #f1f1f1;
}

[data-theme="dark"] .deck-table-container {
    background: var(--bg-primary);
    scrollbar-color: #666 var(--bg-secondary);
}

[data-theme="dark"] .deck-table-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

[data-theme="dark"] .deck-table-container::-webkit-scrollbar-thumb {
    background: #666;
    border-color: var(--bg-secondary);
}

[data-theme="dark"] .deck-table-container::-webkit-scrollbar-thumb:hover {
    background: #888;
}

[data-theme="dark"] .deck-table-container::-webkit-scrollbar-corner {
    background: var(--bg-secondary);
}

/* Deck Table */
.deck-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.deck-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.deck-table th {
    background: #34495e;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid #2c3e50;
}

[data-theme="dark"] .deck-table th {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
}

.deck-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
}

[data-theme="dark"] .deck-table td {
    border-bottom: 1px solid var(--border-color);
}

.deck-table tr:hover {
    background: #f8f9fa;
}

[data-theme="dark"] .deck-table tr:hover {
    background: var(--bg-secondary);
}

.deck-table tr.edited-row {
    background: rgba(79, 70, 229, 0.05);
    border-left: 3px solid var(--primary);
}

[data-theme="dark"] .deck-table tr.edited-row {
    background: rgba(99, 102, 241, 0.1);
}

/* Sortable Header Styles */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.sortable-header:hover {
    background: #2c3e50 !important;
}

.deck-table th.word-column,
.deck-table td.word-column {
    min-width: 180px;
    width: auto;
}

.deck-table .actions-cell {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.deck-table .actions-cell .btn-icon {
    padding: 4px 6px;
}

.deck-table .actions-cell .add-below-btn {
    color: var(--success);
}

.deck-table .actions-cell .delete-card-btn {
    color: var(--danger);
}

/* Lesson Group Header Rows */
.lesson-header-row {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    cursor: pointer;
    user-select: none;
}

.lesson-header-row:hover {
    background: linear-gradient(135deg, #5558e8 0%, #5558dd 100%);
}

.lesson-header-cell {
    padding: 12px 16px !important;
}

.lesson-header {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-weight: 600;
}

.lesson-chevron {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.lesson-header-row:not(.collapsed) .lesson-chevron {
    transform: rotate(90deg);
}

.lesson-title {
    font-size: 15px;
}

.lesson-count {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 400;
    margin-left: auto;
}

/* Review Lesson Styles */
.lesson-header-row.review-lesson {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

.lesson-header-row.review-lesson:hover {
    background: linear-gradient(135deg, #9d72f7 0%, #b69df5 100%);
}

[data-theme="dark"] .lesson-header-row.review-lesson {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
}

[data-theme="dark"] .lesson-header-row.review-lesson:hover {
    background: linear-gradient(135deg, #8b4cf7 0%, #9b6cf9 100%);
}

.lesson-review-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.lesson-review-badge i {
    margin-right: 4px;
}

.lesson-reviews {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 400;
}

.add-lesson-btn {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.add-lesson-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.add-lesson-btn i {
    font-size: 14px;
}

.lesson-card-row.hidden {
    display: none;
}

[data-theme="dark"] .lesson-header-row {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
}

[data-theme="dark"] .lesson-header-row:hover {
    background: linear-gradient(135deg, #5558e8 0%, #7c7ce8 100%);
}

[data-theme="dark"] .sortable-header:hover {
    background: var(--bg-primary) !important;
}

.sort-icon {
    margin-left: 6px;
    opacity: 0.5;
    font-size: 11px;
}

.sort-icon.active {
    opacity: 1;
    color: #3498db;
}

.lesson-range-input {
    width: 70px !important;
    text-align: center;
}

/* Word Cell Container with Notes */
.word-cell-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.word-cell-container .word-input {
    flex: 1;
}

/* Notes Button Styles */
.notes-btn {
    padding: 4px 6px;
    border: none;
    background: var(--bg-secondary);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
}

.notes-btn:hover {
    background: var(--primary);
    color: white;
}

.notes-btn.has-note {
    background: #27ae60;
    color: white;
}

.notes-btn.has-note:hover {
    background: #219a52;
}

.note-check {
    font-size: 8px;
    position: absolute;
    top: -2px;
    right: -2px;
    background: white;
    color: #27ae60;
    border-radius: 50%;
    padding: 1px;
}

/* Notes Modal Styles */
#notesModal .modal-content {
    max-width: 500px;
}

#notesModal textarea {
    resize: vertical;
    min-height: 100px;
}

#notesModal .action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

#notesModal .btn-warning {
    background: #f39c12;
}

#notesModal .btn-warning:hover {
    background: #e67e22;
}

/* Cell Inputs */
.cell-input,
.cell-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
}

.cell-input:focus,
.cell-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.cell-input[type="number"] {
    width: 60px;
}

.cell-select {
    cursor: pointer;
    padding: 6px 4px;
}

/* File Upload Badges */
.file-upload-badge-container {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.audio-badges-container {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.file-badge.upload-trigger {
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
}

.file-badge.upload-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    border-color: rgba(0,0,0,0.1);
}

.file-badge.has-file {
    background: #1abc9c;
    color: white;
}

.file-badge.no-file {
    background: #95a5a6;
    color: white;
    opacity: 0.7;
}

.file-badge.no-file:hover {
    opacity: 1;
    background: #7f8c8d;
}

.file-badge.png {
    background: #1abc9c;
}

.file-badge.gif {
    background: #e67e22;
}

.file-badge.audio.has-file {
    background: #9b59b6;
}

.file-badge.audio.no-file {
    background: #bdc3c7;
}

.file-badge i {
    font-size: 10px;
}

.format-icon {
    display: inline-block;
    padding: 2px 4px;
    margin-left: 3px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Status Badges */
.status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-complete-animated {
    background: #27ae60;
    color: white;
}

.status-complete-static {
    background: #2ecc71;
    color: white;
}

.status-gif-only {
    background: #f39c12;
    color: white;
}

.status-image-only {
    background: #e67e22;
    color: white;
}

.status-audio-only {
    background: #9b59b6;
    color: white;
}

.status-partial {
    background: #e74c3c;
    color: white;
}

.status-missing {
    background: #95a5a6;
    color: white;
}

/* Type Badges */
.type-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
}

.type-badge.new {
    background: #27ae60;
    color: white;
}

.type-badge.review {
    background: #f39c12;
    color: white;
}

/* Lesson Badge */
.lesson-badge {
    background: #3498db;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
}

/* Action Buttons */
.delete-card-btn {
    color: var(--error);
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.delete-card-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

.add-below-btn {
    color: var(--success) !important;
    font-size: 16px;
}

.add-below-btn:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success) !important;
    transform: scale(1.1);
}

/* Categories Button */
.categories-btn {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    width: 100%;
    white-space: nowrap;
}

.categories-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* ============================================
   Tablet Responsive (1024px)
   ============================================ */
@media (max-width: 1024px) {
    .deck-header {
        flex-direction: column;
        align-items: stretch;
    }

    .deck-actions {
        width: 100%;
        justify-content: space-between;
    }

    .deck-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .stats-mini {
        margin-left: 0;
        justify-content: space-between;
    }

    .deck-table-container {
        font-size: 12px;
    }

    .cell-input,
    .cell-select {
        font-size: 12px;
        padding: 4px 6px;
    }

    .lesson-range-input {
        width: 60px !important;
    }

    .filter-group.search-group {
        flex-basis: 100%;
        order: 10;
    }

    .filter-group.search-group input {
        max-width: none;
    }

    .deck-controls .btn-success {
        order: 11;
    }

    .word-cell-container {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .notes-btn {
        align-self: flex-end;
    }
}
