/* Soulful Evolution CMS - Production Styles */
/* Author: Pavan */
/* Version: 1.0.0 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fafbfc;
    min-height: 100vh;
    padding: 24px;
    color: #2d3748;
    line-height: 1.5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 32px;
}

/* Spinner animation for loading states */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* YouTube statistics styling */
.youtube-stats {
    text-align: center;
    background: #f8fafc;
    color: #2d3748;
    font-family: 'Courier New', monospace;
}

/* Tags styling */
.tag {
    display: inline-block;
    background: #e2e8f0;
    color: #4a5568;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin: 1px 2px;
    text-transform: lowercase;
}

.no-tags {
    color: #a0aec0;
    font-style: italic;
    font-size: 12px;
}

.tags-display {
    max-width: 120px;
    overflow: hidden;
}

/* Description and Tags Editor */
.description-tags-editor {
    width: 100%;
}

.description-tags-editor label {
    display: block;
    margin: 16px 0 8px 0;
    font-weight: 600;
    color: #4a5568;
}

.description-tags-editor label:first-child {
    margin-top: 0;
}

.description-tags-editor textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.description-tags-editor input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

.description-tags-editor textarea:focus,
.description-tags-editor input:focus {
    outline: none;
    border-color: #805ad5;
    box-shadow: 0 0 0 3px rgba(128, 90, 213, 0.1);
}

.tags-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.tags-list .tag {
    margin: 4px 6px 4px 0;
    padding: 4px 10px;
    font-size: 12px;
}

/* Thumbnail Components */
.thumbnail-preview {
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s;
    min-width: 80px;
    max-width: 140px;
}

.thumbnail-preview:hover {
    transform: scale(1.02);
}

.no-thumbnails {
    padding: 12px 16px;
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    text-align: center;
    border-radius: 6px;
    border: 1px dashed #cbd5e1;
}

.thumbnail-preview-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.thumbnail-image {
    width: 50px;
    height: 35px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.thumbnail-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #805ad5;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

/* Thumbnail Manager */
.thumbnail-manager, .thumbnail-viewer {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 90vw;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.thumbnail-header, .viewer-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thumbnail-header h2, .viewer-header h2 {
    margin: 0;
    font-size: 18px;
    color: #1a202c;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close-btn:hover {
    background: #f1f5f9;
}

.upload-area {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafbfc;
}

.upload-dropzone:hover, .upload-dropzone.drag-over {
    border-color: #805ad5;
    background: #f8f6ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.upload-text strong {
    display: block;
    font-size: 16px;
    color: #1a202c;
    margin-bottom: 8px;
}

.upload-text p {
    color: #64748b;
    font-size: 14px;
    margin: 0;
}

.thumbnails-grid, .viewer-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    max-height: 500px;
    overflow-y: auto;
}

.thumbnail-item, .viewer-thumbnail {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    border: 2px solid #e2e8f0;
    transition: all 0.3s;
}

.thumbnail-item:hover {
    border-color: #805ad5;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(128, 90, 213, 0.15);
}

.thumbnail-item img, .viewer-thumbnail img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.thumbnail-item:hover .thumbnail-overlay {
    opacity: 1;
}

.thumbnail-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: white;
    transform: scale(1.1);
}

.btn-icon.active {
    background: #fbbf24;
    color: white;
}

.btn-icon.danger:hover {
    background: #ef4444;
    color: white;
}

.thumbnail-name {
    padding: 8px;
    font-size: 11px;
    color: #64748b;
    text-align: center;
    background: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.primary-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #10b981;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
}

.no-thumbnails-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #64748b;
    font-style: italic;
}

.thumbnail-footer, .viewer-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1a202c;
}

.header p {
    font-size: 16px;
    color: #718096;
    font-weight: 400;
}

/* Stats Bar */
.stats-bar {
    background: #f8fafc;
    padding: 24px 32px;
    display: flex;
    justify-content: space-around;
    border-bottom: 1px solid #e2e8f0;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 28px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
}

/* Controls */
.controls {
    padding: 24px 32px;
    background: #f8fafc;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid #e2e8f0;
}

.btn {
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    background: white;
    color: #4a5568;
}

.btn-primary {
    background: #3182ce;
    color: white;
    border-color: #3182ce;
}

.btn-success {
    background: #38a169;
    color: white;
    border-color: #38a169;
}

.btn-warning {
    background: #d69e2e;
    color: white;
    border-color: #d69e2e;
}

.btn:hover {
    background: #edf2f7;
}

.btn-primary:hover { background: #2c5282; }
.btn-success:hover { background: #2f855a; }
.btn-warning:hover { background: #b7791f; }

.filter-select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #4a5568;
}

.filter-select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Content Table */
.content-table {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    background: #f7fafc;
    color: #4a5568;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    font-size: 14px;
}

/* Title column - make it wider */
td:nth-child(4) {
    min-width: 250px;
    max-width: 350px;
}

/* Notes column - make it wider */
td:nth-child(15) {
    min-width: 250px;
    max-width: 400px;
}

tr:hover {
    background: #f8fafc;
}

/* Status Badges */
.status-uploaded {
    background: #c6f6d5;
    color: #2d5a41;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    display: inline-block;
}

.status-recording, .status-script, .status-editing {
    background: #fed7cc;
    color: #7b341e;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    display: inline-block;
}

.status-pending {
    background: #fed7d7;
    color: #63171b;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    display: inline-block;
}

/* Priority Indicators */
.priority-urgent {
    border-left: 3px solid #e53e3e;
}

.priority-high {
    border-left: 3px solid #dd6b20;
}

.priority-medium {
    border-left: 3px solid #38a169;
}

.priority-low {
    border-left: 3px solid #718096;
}

.priority-none {
    border-left: 3px solid #cbd5e0;
    opacity: 0.9;
}

/* Links */
.content-link {
    color: #3182ce;
    text-decoration: none;
    font-weight: 500;
}

.content-link:hover {
    text-decoration: underline;
    color: #2c5282;
}

/* Single Thumbnail Viewer */
.single-thumbnail-viewer {
    background: white;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    margin: 2vh auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.single-viewer-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.single-viewer-header h2 {
    margin: 0;
    font-size: 18px;
    color: #1a202c;
}

.content-title {
    font-size: 14px;
    color: #64748b;
    font-style: italic;
}

.single-viewer-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fafbfc;
}

.single-thumbnail-image {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.primary-indicator {
    margin-top: 15px;
    padding: 8px 16px;
    background: #805ad5;
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.single-viewer-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
    background: white;
}

/* Fix gallery view consistency */
.edit-mode .thumbnails-grid {
    /* Ensure edit mode doesn't shrink thumbnails */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    max-height: 500px !important;
}

/* Thumbnail Preview */
.thumbnail-preview {
    width: 60px;
    height: 40px;
    background: #e9ecef;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #666;
}

/* Team Members */
.team-member {
    display: inline-block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: white;
    text-align: center;
    line-height: 30px;
    font-size: 12px;
    font-weight: bold;
    margin-right: 5px;
}

.tim { background: #667eea; }
.pavan { background: #28a745; }
.allison { background: #dc3545; }
.grace { background: #ffc107; color: #212529; }
.sasha { background: #6f42c1; }

/* Notes */
.notes {
    max-width: 400px;
    font-size: 13px;
    color: #4a5568;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: normal;
}

/* Footer */
.footer {
    background: #f7fafc;
    color: #4a5568;
    padding: 24px 32px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

.last-updated {
    font-size: 14px;
    color: #718096;
}

/* Edit Mode Styles */
.edit-mode {
    background: #fffbeb !important;
    border: 1px solid #fbbf24 !important;
}

.edit-mode .header {
    background: #fef3c7;
    border-bottom-color: #fbbf24;
}

.editable {
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    position: relative;
}

.editable:hover {
    background: #fef3c7;
    border: 1px dashed #fbbf24;
}

.editable::after {
    content: '✏️';
    position: absolute;
    right: 2px;
    top: 2px;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.editable:hover::after {
    opacity: 1;
}

/* Edit Form */
.edit-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    z-index: 2000;
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
}

.edit-form h3 {
    margin-bottom: 16px;
    color: #1a202c;
    font-size: 18px;
}

.edit-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.edit-form input, .edit-form textarea, .edit-form select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}

.edit-form textarea {
    min-height: 80px;
    resize: vertical;
}

.edit-form input:focus, .edit-form textarea:focus, .edit-form select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.edit-form-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Delete Button Styles */
.delete-cell {
    text-align: center;
    padding: 8px !important;
}

.btn-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #fed7d7;
    transform: scale(1.1);
}

/* Beautiful Description Modal */
.description-modal {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    max-height: 90vh;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.description-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.description-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    flex: 1;
    padding-right: 20px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.description-content {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    line-height: 1.7;
    font-size: 15px;
    color: #2d3748;
}

.description-content p {
    margin-bottom: 16px;
    text-align: justify;
}

.description-content p:last-child {
    margin-bottom: 0;
}

.bullet {
    color: #667eea;
    font-weight: bold;
    margin-right: 8px;
}

.hashtag {
    color: #3182ce !important;
    font-weight: 600;
    background: #ebf8ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    text-decoration: none !important;
    cursor: default !important;
    pointer-events: none !important;
    display: inline-block;
    user-select: text;
    -webkit-user-select: text;
}

/* Ensure hashtags don't act like links even when inside other elements */
a .hashtag,
.hashtag a {
    pointer-events: none !important;
    cursor: default !important;
    text-decoration: none !important;
}

.description-link {
    color: #3182ce;
    text-decoration: none;
    font-weight: 500;
    background: #ebf8ff;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.description-link:hover {
    background: #bee3f8;
    text-decoration: underline;
}

.section-header {
    font-weight: 700;
    color: #1a202c;
    font-size: 16px;
    margin: 24px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.no-description {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 40px 20px;
    font-size: 16px;
}

.description-footer {
    background: #f8fafc;
    padding: 20px 32px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
}

/* Mobile responsive for description modal */
@media (max-width: 768px) {
    .description-modal {
        margin: 10px;
        max-height: 95vh;
    }
    
    .description-header {
        padding: 20px;
    }
    
    .description-header h2 {
        font-size: 18px;
    }
    
    .description-content {
        padding: 20px;
        font-size: 14px;
    }
    
    .description-footer {
        padding: 16px 20px;
    }
}

/* Mobile Responsive - iPhone Optimized */
@media (max-width: 480px) {
    body {
        padding: 4px;
        font-size: 14px;
        -webkit-text-size-adjust: 100%;
        touch-action: manipulation;
    }
    
    .container {
        border-radius: 8px;
        margin: 0;
        max-width: 100%;
    }
    
    .header {
        padding: 12px 16px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 18px;
        margin-bottom: 4px;
        line-height: 1.2;
    }
    
    .header p {
        font-size: 13px;
        line-height: 1.3;
    }
    
    .stats-bar {
        padding: 12px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .stat-item {
        padding: 8px;
        background: white;
        border-radius: 6px;
        border: 1px solid #e2e8f0;
    }
    
    .stat-number {
        font-size: 20px;
        margin-bottom: 2px;
    }
    
    .stat-label {
        font-size: 11px;
        line-height: 1.2;
    }
    
    .controls {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
    }
    
    .btn, .filter-select {
        width: 100%;
        padding: 14px 16px;
        font-size: 15px;
        border-radius: 8px;
        min-height: 44px;
        box-sizing: border-box;
        -webkit-appearance: none;
    }
    
    .content-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
        margin: 0 -4px;
        padding: 0 4px;
    }
    
    .content-table::after {
        content: '← Swipe to see more →';
        position: sticky;
        right: 4px;
        bottom: 4px;
        background: rgba(59, 130, 246, 0.9);
        color: white;
        padding: 6px 12px;
        font-size: 10px;
        border-radius: 12px;
        pointer-events: none;
        z-index: 5;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    
    table {
        min-width: 800px;
        font-size: 11px;
        border-collapse: separate;
        border-spacing: 0;
    }
    
    th {
        padding: 8px 4px;
        font-size: 10px;
        position: sticky;
        top: 0;
        background: #f7fafc;
        z-index: 10;
        border-bottom: 2px solid #e2e8f0;
    }
    
    td {
        padding: 10px 4px;
        white-space: nowrap;
        vertical-align: middle;
    }
    
    /* Make first column (title) wider and allow wrapping */
    td:nth-child(4) {
        min-width: 120px;
        max-width: 180px;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.3;
    }
    
    .notes {
        max-width: 140px;
        font-size: 10px;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.3;
    }
    
    .team-member {
        width: 20px;
        height: 20px;
        line-height: 20px;
        font-size: 9px;
        margin-right: 2px;
    }
    
    .footer {
        padding: 12px 16px;
        font-size: 11px;
        text-align: center;
    }
    
    .footer p {
        margin-bottom: 4px;
    }
}

/* Tablets */
@media (min-width: 481px) and (max-width: 768px) {
    body {
        padding: 16px;
    }
    
    .header {
        padding: 24px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .stats-bar {
        padding: 20px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    .controls {
        padding: 20px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .btn {
        flex: 1;
        min-width: 140px;
    }
    
    .filter-select {
        flex: 1;
        min-width: 120px;
    }
    
    table {
        font-size: 13px;
    }
    
    th, td {
        padding: 12px 8px;
    }
    
    .notes {
        max-width: 150px;
    }
}

/* Desktop */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 95%;
    }
    
    .stats-bar {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    
    .controls {
        justify-content: space-between;
    }
    
    table {
        font-size: 14px;
    }
}

/* Large Desktop */
@media (min-width: 1025px) and (max-width: 1400px) {
    .container {
        max-width: 1200px;
    }
}

/* Extra Large */
@media (min-width: 1401px) {
    .container {
        max-width: 1400px;
    }
    
    .header h1 {
        font-size: 28px;
    }
    
    .stat-number {
        font-size: 32px;
    }
    
    table {
        font-size: 15px;
    }
    
    th, td {
        padding: 18px;
    }
}

/* Ultra-wide */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
    
    .header {
        padding: 40px;
    }
    
    .stats-bar, .controls {
        padding: 32px 40px;
    }
}

/* Portrait phones */
@media (orientation: portrait) and (max-width: 768px) {
    .stats-bar {
        grid-template-columns: 1fr 1fr;
    }
}

/* Landscape phones */
@media (orientation: landscape) and (max-height: 500px) {
    .header {
        padding: 12px 24px;
    }
    
    .header h1 {
        font-size: 18px;
        margin-bottom: 2px;
    }
    
    .header p {
        font-size: 13px;
    }
    
    .stats-bar {
        padding: 12px 24px;
    }
    
    .controls {
        padding: 12px 24px;
    }
}

/* iPhone Specific Optimizations */
@media (max-width: 480px) {
    /* Touch-friendly buttons and interactive elements */
    .btn-delete, .editable, .thumbnail-preview, .btn-icon {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }
    
    /* Modal optimizations for iPhone */
    .modal-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: 40px;
    }
    
    .edit-form {
        width: 95%;
        max-width: none;
        margin: 0;
        position: relative;
        top: 0;
        left: 0;
        transform: none;
        max-height: 85vh;
        border-radius: 12px;
    }
    
    .edit-form input, .edit-form textarea, .edit-form select {
        padding: 12px;
        font-size: 16px; /* Prevents iOS zoom */
        border-radius: 8px;
        -webkit-appearance: none;
    }
    
    .edit-form-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .edit-form-buttons .btn {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        border-radius: 8px;
    }
    
    /* Thumbnail manager mobile optimization */
    .thumbnail-manager, .thumbnail-viewer, .single-thumbnail-viewer {
        width: 95vw;
        height: 90vh;
        max-width: none;
        max-height: 90vh;
        margin: 5vh 2.5vw;
        border-radius: 12px;
    }
    
    .thumbnails-grid, .viewer-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
        padding: 12px;
        max-height: 60vh;
    }
    
    .thumbnail-item, .viewer-thumbnail {
        border-radius: 8px;
    }
    
    .thumbnail-item img, .viewer-thumbnail img {
        height: 80px;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .thumbnail-name {
        font-size: 10px;
        padding: 6px;
    }
    
    .upload-dropzone {
        padding: 24px 12px;
        border-radius: 8px;
    }
    
    .upload-icon {
        font-size: 36px;
        margin-bottom: 12px;
    }
    
    .upload-text strong {
        font-size: 14px;
    }
    
    .upload-text p {
        font-size: 12px;
    }
    
    /* Description modal mobile */
    .description-modal {
        width: 95%;
        max-width: none;
        margin: 20px auto;
        max-height: 85vh;
        border-radius: 12px;
    }
    
    .description-header {
        padding: 16px 20px;
    }
    
    .description-header h2 {
        font-size: 16px;
        line-height: 1.2;
    }
    
    .description-content {
        padding: 20px;
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* Status badges mobile */
    .status-uploaded, .status-recording, .status-script, .status-editing, .status-pending {
        font-size: 10px;
        padding: 3px 6px;
        border-radius: 4px;
    }
    
    /* Tags mobile */
    .tag {
        font-size: 9px;
        padding: 2px 6px;
        margin: 1px;
        border-radius: 8px;
    }
    
    /* Thumbnail preview in table mobile */
    .thumbnail-preview {
        width: 40px;
        height: 28px;
        font-size: 8px;
    }
    
    .thumbnail-image {
        width: 35px;
        height: 24px;
        border-radius: 3px;
        border-width: 1px;
    }
    
    .thumbnail-count {
        font-size: 8px;
        padding: 1px 4px;
        min-width: 14px;
        border-radius: 7px;
    }
    
    /* Edit mode optimizations */
    .edit-mode .container {
        border-color: #f59e0b;
        border-width: 2px;
    }
    
    .editable {
        padding: 8px;
        border-radius: 6px;
        margin: 2px 0;
    }
    
    .editable::after {
        font-size: 12px;
        right: 4px;
        top: 4px;
    }
}

/* iPhone X and newer (safe areas) */
@supports (padding: max(0px)) {
    @media (max-width: 480px) {
        body {
            padding: max(4px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
        }
        
        .header {
            padding-top: max(12px, env(safe-area-inset-top));
        }
    }
}
