/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #f5f5f5;
    color: #2d3748;
    line-height: 1.6;
    overflow: hidden;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Container */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
header {
    background: #14b8a6;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #0d9488;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    gap: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.header-controls .search-box {
    flex: 1;
    max-width: 400px;
    min-width: 200px;
    background: white;
    border: 2px solid #0d9488;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #2d3748;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-controls .search-box::placeholder {
    color: #94a3b8;
    font-style: italic;
}

.header-controls .search-box:hover {
    border-color: #0f766e;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.header-controls .search-box:focus {
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3), 0 4px 8px rgba(0, 0, 0, 0.2);
    outline: none;
}

.header-controls .filter-checkbox {
    color: white;
    white-space: nowrap;
}

.header-controls .filter-checkbox input[type="checkbox"] {
    accent-color: white;
}

.stats {
    color: #e0f2f1;
    font-size: 0.9rem;
    white-space: nowrap;
    margin-left: auto;
}

/* Main content layout */
.main-content {
    display: flex;
    gap: 0;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.main-content .video-list-panel {
    flex: 0 0 300px;
}

.main-content .player-panel {
    flex: 1 1 auto;
}

.main-content .transcript-panel {
    flex: 0 0 400px;
}

/* Panel styles */
.video-list-panel,
.player-panel,
.transcript-panel {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow: hidden;
}

.video-list-panel {
    border-right: 1px solid #e2e8f0;
    position: relative;
    min-width: 200px;
    max-width: 800px;
}

/* Resize handle */
.resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 100;
    transition: background 0.2s;
}

.resize-handle:hover {
    background: #14b8a6;
}

.resize-handle.resizing {
    background: #0d9488;
}

.transcript-panel {
    border-left: 1px solid #e2e8f0;
    position: relative;
    min-width: 250px;
    max-width: 800px;
}

/* Resize handle for transcript panel (left side) */
.resize-handle-left {
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 100;
    transition: background 0.2s;
}

.resize-handle-left:hover {
    background: #14b8a6;
}

.resize-handle-left.resizing {
    background: #0d9488;
}

.panel-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #14b8a6;
    background: #f0fdfa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    color: #0d9488;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.video-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.video-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f7fafc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid #e2e8f0;
}

.video-item:hover {
    background: #e6fffa;
    border-color: #14b8a6;
    transform: translateX(4px);
}

.video-item.active {
    background: #ccfbf1;
    border-color: #14b8a6;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.2);
}

.video-item.hidden {
    display: none;
}

.video-name {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    word-break: break-word;
    line-height: 1.4;
    color: #2d3748;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #718096;
    margin-top: 0.5rem;
}

.subtitle-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    background: #14b8a6;
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.no-subtitle-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    background: #e2e8f0;
    color: #718096;
    border-radius: 4px;
    font-size: 0.7rem;
}

.format-compatible {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    background: #d1fae5;
    color: #065f46;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.format-warning {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #718096;
}

/* Player panel */
.player-panel {
    display: flex;
    flex-direction: column;
}

.player-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #fff;
    padding: 1rem;
}

#video-player {
    width: 100%;
    height: 100%;
    display: none;
}

#video-player.active {
    display: block;
}

.no-video-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f7fafc;
}

.no-video-message.hidden {
    display: none;
}

.message-content {
    text-align: center;
    color: #a0aec0;
}

.message-content p {
    font-size: 1.1rem;
}

.video-info {
    padding: 1rem 1.5rem;
    background: #f0fdfa;
    border-top: 2px solid #14b8a6;
}

.video-info h3 {
    font-size: 1rem;
    font-weight: 500;
    color: #0d9488;
}

/* Custom controls */
.custom-controls {
    padding: 1rem 1.5rem;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.control-group label {
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 500;
}

.control-btn {
    padding: 0.5rem 1rem;
    background: #14b8a6;
    border: 2px solid #14b8a6;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.control-btn:hover:not(:disabled) {
    background: #0d9488;
    border-color: #0d9488;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(20, 184, 166, 0.3);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.icon {
    font-size: 1rem;
}

.slider {
    width: 100px;
    cursor: pointer;
    accent-color: #14b8a6;
}

.speed-select {
    padding: 0.4rem 0.6rem;
    background: #ffffff;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    color: #2d3748;
    cursor: pointer;
    font-size: 0.9rem;
}

.speed-select:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

#volume-value {
    font-size: 0.85rem;
    color: #4a5568;
    min-width: 45px;
    font-weight: 500;
}

/* Transcript panel */
.transcript-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.transcript-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.no-transcript {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #a0aec0;
    padding: 2rem;
}

.no-transcript p {
    margin-bottom: 0.5rem;
    color: #718096;
}

.no-transcript .hint {
    font-size: 0.85rem;
    color: #a0aec0;
}

.transcript-line {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f7fafc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid #e2e8f0;
}

.transcript-line:hover {
    background: #e6fffa;
    border-left-color: #14b8a6;
    transform: translateX(2px);
}

.transcript-line.active {
    background: #ccfbf1;
    border-left-color: #14b8a6;
    box-shadow: 0 2px 4px rgba(20, 184, 166, 0.2);
}

.transcript-timestamp {
    font-size: 0.75rem;
    color: #14b8a6;
    margin-bottom: 0.25rem;
    font-family: monospace;
    font-weight: 600;
}

.transcript-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #2d3748;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #14b8a6;
}

/* Icon button */
.icon-btn {
    background: transparent;
    border: none;
    color: #14b8a6;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover:not(:disabled) {
    background: #e6fffa;
    color: #0d9488;
}

.icon-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.transcript-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-in-out;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #14b8a6;
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #0d9488;
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    line-height: 1.8;
}

/* Modal transcript styling - optimized for reading */
.modal-transcript-line {
    padding: 1.25rem 1.5rem;
    margin-bottom: 0.75rem;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #14b8a6;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-transcript-line:hover {
    background: #e6fffa;
    border-left-width: 6px;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.15);
}

.modal-transcript-line.active {
    background: #ccfbf1;
    border-left-width: 6px;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.25);
}

.modal-transcript-timestamp {
    font-size: 0.85rem;
    color: #14b8a6;
    font-family: monospace;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: inline-block;
    background: #e6fffa;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.modal-transcript-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2d3748;
    letter-spacing: 0.01em;
}

/* Font size controls */
.modal-body[data-font-size="small"] .modal-transcript-text {
    font-size: 0.95rem;
}

.modal-body[data-font-size="medium"] .modal-transcript-text {
    font-size: 1.1rem;
}

.modal-body[data-font-size="large"] .modal-transcript-text {
    font-size: 1.3rem;
}

.modal-body[data-font-size="xlarge"] .modal-transcript-text {
    font-size: 1.5rem;
}

/* Video Table Styles */
.video-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    table-layout: fixed;
}

.video-table thead {
    background: #f0fdfa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.video-table th {
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #0d9488;
    border-bottom: 2px solid #14b8a6;
    white-space: nowrap;
}

/* Column widths for alignment */
.video-table th:nth-child(1),
.video-table td:nth-child(1) {
    width: 45%;
    min-width: 200px;
}

.video-table th:nth-child(2),
.video-table td:nth-child(2) {
    width: 20%;
    min-width: 90px;
}

.video-table th:nth-child(3),
.video-table td:nth-child(3) {
    width: 20%;
    min-width: 110px;
}

.video-table th:nth-child(4),
.video-table td:nth-child(4) {
    width: 15%;
    min-width: 90px;
}

.video-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.video-table th.sortable:hover {
    background: #ccfbf1;
    color: #0f766e;
}

.video-table th.sortable.active-sort {
    background: #ccfbf1;
    font-weight: 700;
}

.sort-indicator {
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 0.7rem;
    color: #14b8a6;
    min-width: 0.75rem;
}

.video-row {
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.video-row:hover {
    background: #e6fffa;
}

.video-row.active {
    background: #ccfbf1;
    font-weight: 500;
}

.video-table td {
    padding: 0.6rem 0.5rem;
}

.video-name-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2d3748;
}

.duration-cell,
.size-cell {
    text-align: right;
    font-family: monospace;
    color: #4a5568;
    white-space: nowrap;
}

.date-cell {
    color: #4a5568;
    white-space: nowrap;
}

.subtitle-cell {
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
}

.subtitle-cell.has-sub {
    color: #14b8a6;
}

.subtitle-cell.no-sub {
    color: #cbd5e0;
}

.no-videos {
    text-align: center;
    padding: 2rem;
    color: #718096;
    font-style: italic;
}

.loading-row {
    background: transparent;
}

.loading-row td {
    text-align: center;
    padding: 2rem;
    color: #718096;
}

/* Responsive design */
@media (max-width: 1200px) {
    .header-controls .search-box {
        max-width: 300px;
    }
}

@media (max-width: 900px) {
    header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .header-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-controls .search-box {
        max-width: none;
        width: 100%;
    }

    .stats {
        margin-left: 0;
    }

    .main-content {
        flex-direction: column;
    }

    .main-content .video-list-panel {
        flex: 0 0 200px !important;
    }

    .main-content .transcript-panel {
        flex: 0 0 200px;
    }

    .video-list-panel,
    .transcript-panel {
        border: none;
        border-bottom: 1px solid #2a2a2a;
        max-height: 200px;
    }

    .custom-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .control-group {
        justify-content: space-between;
    }
}

/* Progress Tracking Styles */

/* Continue Watching Section */
.continue-watching-section {
    padding: 1rem;
    background: #f0fdfa;
    border-bottom: 2px solid #14b8a6;
}

.continue-watching-section.hidden {
    display: none;
}

.continue-watching-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0d9488;
    margin-bottom: 0.75rem;
}

.continue-watching-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.continue-watching-item {
    padding: 0.75rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.continue-watching-item:hover {
    border-color: #14b8a6;
    background: #e6fffa;
    transform: translateX(2px);
}

.continue-watching-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.continue-watching-name {
    font-size: 0.85rem;
    color: #2d3748;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 0.5rem;
}

.continue-watching-progress {
    font-size: 0.75rem;
    color: #14b8a6;
    font-weight: 600;
    white-space: nowrap;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #14b8a6 0%, #0d9488 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Video Name Cell with Status Icon */
.video-name-cell {
    position: relative;
}

.video-name-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.watch-status-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.video-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Watch Status Colors */
.video-row.watched {
    opacity: 0.6;
}

.video-row.watched .watch-status-icon {
    color: #059669;
}

.video-row.in-progress .watch-status-icon {
    color: #14b8a6;
}

.video-row.unwatched .watch-status-icon {
    color: #cbd5e1;
}

/* Mark Watched Button */
.control-btn.watched {
    background: #059669;
    border-color: #059669;
}

.control-btn.watched:hover:not(:disabled) {
    background: #047857;
    border-color: #047857;
}

/* Last Read Transcript Line Highlight */
.modal-transcript-line.last-read {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding-left: 1rem;
}

/* Video table progress bar styling */
.video-table .video-name-cell .progress-bar-container {
    margin-top: 0.25rem;
}

/* Toggle Panel Button */
.toggle-panel-btn {
    position: absolute;
    top: 50%;
    right: -20px;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background: #14b8a6;
    border: 2px solid #0d9488;
    border-radius: 0 8px 8px 0;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 101;
    transition: all 0.2s ease;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.toggle-panel-btn:hover {
    background: #0d9488;
    width: 32px;
}

.toggle-panel-btn .icon {
    font-size: 1rem;
}

/* Expand Panel Button (shown when collapsed) */
.expand-panel-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background: #14b8a6;
    border: 2px solid #0d9488;
    border-radius: 0 8px 8px 0;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.2s ease;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.expand-panel-btn:hover {
    background: #0d9488;
    width: 32px;
}

.expand-panel-btn .icon {
    font-size: 1rem;
}

.expand-panel-btn.hidden {
    display: none;
}

/* Collapsed Video List Panel */
.video-list-panel.collapsed {
    flex: 0 0 0px !important;
    min-width: 0;
    overflow: hidden;
    border-right: none;
}

.video-list-panel.collapsed .toggle-panel-btn {
    right: -30px;
}

.video-list-panel {
    transition: flex 0.3s ease;
    position: relative;
}

/* ================================================
   ARTICLE READER STYLES
   ================================================ */

/* Mode Toggle */
.header-title {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.mode-toggle {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.25rem;
    border-radius: 8px;
}

.mode-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mode-btn.active {
    background: white;
    color: #14b8a6;
    font-weight: 600;
}

/* Article Reader Container */
/* ===== PRESENTATION MODE ===== */

.presentation-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
}

.presentation-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Presentation List Panel */
.presentation-list-panel {
    flex: 0 0 450px;
    display: flex;
    flex-direction: column;
    background: white;
    border-right: 1px solid #ddd;
    position: relative;
    transition: flex 0.3s ease;
    min-width: 0;
}

.presentation-list-panel.collapsed {
    flex: 0 0 0px !important;
    min-width: 0;
    overflow: hidden;
    border-right: none;
}

.presentation-list-panel.collapsed .toggle-panel-btn {
    right: -30px;
}

.presentation-list {
    flex: 1;
    overflow-y: auto;
}

.presentation-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.presentation-table th,
.presentation-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.presentation-table th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    font-weight: 600;
}

.presentation-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
}

.presentation-table th:nth-child(2),
.presentation-table td:nth-child(2) {
    width: 80px;
}

.presentation-table th:nth-child(3),
.presentation-table td:nth-child(3) {
    width: 120px;
}

.presentation-row {
    cursor: pointer;
    transition: background 0.2s;
}

.presentation-row:hover {
    background: #f5f5f5;
}

.presentation-row .status-icon {
    display: inline-block;
    width: 20px;
    text-align: center;
}

/* Continue Viewing Section */
.continue-presenting-section {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    min-width: 0;
}

.continue-presenting-section h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
}

.continue-viewing-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border-radius: 5px;
    transition: background 0.2s;
}

.continue-viewing-item:hover {
    background: #e9ecef;
}

.continue-viewing-content {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.continue-viewing-name {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.continue-viewing-progress {
    font-size: 11px;
    color: #666;
    margin-bottom: 5px;
}

.remove-continue-btn {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border: none;
    background: #dc3545;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: all 0.2s;
    opacity: 0.7;
}

.remove-continue-btn:hover {
    opacity: 1;
    background: #c82333;
    transform: scale(1.1);
}

.continue-viewing-item:not(:hover) .remove-continue-btn {
    opacity: 0.3;
}

/* Slide Viewer Panel */
.slide-viewer-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #2c2c2c;
}

.slide-viewer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.no-presentation-message {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 18px;
}

.slide-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 20px;
}

/* Slide Content Wrapper - contains the slide */
.slide-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 30px;
    background: #f8f9fa;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Current Slide Container */
.current-slide-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: visible;
    border: 3px solid #007bff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.current-slide-content {
    display: flex;
    flex-direction: row;
    gap: 40px;
    padding: 40px;
    align-items: flex-start;
    min-height: 0;
}

/* Slide Text Column - contains context and caption */
.slide-text-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
}

/* Context Panels (Previous/Next) within text column */
.slide-context {
    flex: 0 0 auto;
    background: #f8f9fa;
    padding: 20px;
    border-left: 4px solid #dee2e6;
    transition: all 0.2s ease;
    margin-bottom: 0;
}

.slide-context:not(.hidden):hover {
    background: #e9ecef;
    border-left-color: #007bff;
    cursor: pointer;
}

.slide-context.hidden {
    display: none;
}

.slide-context .context-text {
    font-size: 20px;
    line-height: 1.8;
    color: #212529;
    font-weight: 400;
}

.next-context {
    border-left-color: #28a745;
}

/* Slide Image Column */
.slide-image-column {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

.slide-image-container {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    padding: 10px;
    border-radius: 4px;
    max-width: 800px;
}

.slide-image-container img {
    max-width: 100%;
    max-height: calc(100vh - 250px);
    object-fit: contain;
    border-radius: 4px;
}

/* Slide Caption */
.slide-caption-container {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px;
    border-left: 4px solid #007bff;
}

.slide-caption {
    font-size: 20px;
    line-height: 1.8;
    color: #212529;
    flex: 1;
    overflow-y: auto;
    font-weight: 400;
}

/* Navigation Controls */
.slide-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
}

.slide-navigation .slide-counter {
    font-size: 13px;
    color: #6c757d;
    font-weight: 600;
}

.slide-navigation .slide-counter span {
    color: #007bff;
    font-weight: 700;
}

.slide-navigation #jump-to-video-btn {
    padding: 10px 20px;
    font-size: 14px;
}

.nav-btn {
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 500;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.nav-btn .icon {
    font-size: 14px;
}

/* Mode Toggle (update existing) */
.mode-toggle {
    display: flex;
    gap: 10px;
}

.mode-btn {
    padding: 8px 16px;
    background: transparent;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: #007bff;
    color: #007bff;
}

.mode-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

/* Responsive adjustments for presentation mode */
@media (max-width: 1200px) {
    .presentation-list-panel {
        flex: 0 0 380px;
    }

    .slide-content-wrapper {
        max-width: 100%;
        padding: 20px;
    }

    .current-slide-content {
        padding: 30px;
        gap: 30px;
    }

    .slide-context {
        padding: 15px;
    }

    .slide-caption-container {
        padding: 15px;
    }
}

@media (max-width: 900px) {
    .slide-content-wrapper {
        padding: 10px;
    }

    .current-slide-content {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }

    .slide-image-column {
        width: 100%;
        max-width: 100%;
    }

    .slide-image-container {
        max-width: 100%;
        margin: 0 auto;
    }

    .slide-text-column {
        width: 100%;
    }

    .slide-context {
        padding: 15px;
    }

    .slide-caption-container {
        padding: 15px;
    }

    .slide-caption {
        font-size: 18px;
    }

    .slide-context .context-text {
        font-size: 18px;
    }
}

/* Mobile-specific adjustments for iPhone 8 and similar devices (max-width: 480px) */
@media (max-width: 480px) {
    /* Header adjustments for mobile - keep sticky for accessibility */
    header {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
        position: fixed; /* Use fixed instead of sticky */
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: #14b8a6; /* Ensure background */
    }

    /* Remove margin-top since header is no longer sticky */
    .main-content {
        margin-top: 0;
        padding-top: 70px; /* Space for fixed header */
        height: 100vh;
    }

    .player-panel {
        padding-top: 0 !important;
    }

    .header-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }

    /* Hide the app title on mobile to save vertical space */
    header h1 {
        display: none;
    }

    /* Mode toggle buttons - full width on mobile */
    .mode-toggle {
        display: flex;
        flex-wrap: nowrap;
        width: 100%;
        gap: 0.25rem;
        padding: 0;
        background: transparent;
    }

    .mode-btn {
        flex: 1 1 auto;
        min-width: 0;
        padding: 0.5rem 0.4rem;
        font-size: 0.7rem;
        white-space: nowrap;
    }

    /* Presentation container adjustments */
    .presentation-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        height: 100vh;
        padding-top: 70px; /* Space for fixed header */
        box-sizing: border-box;
    }

    /* Remove margin since using padding on container */
    .presentation-main-content {
        margin-top: 0;
        height: 100%;
    }

    /* Article reader container adjustments */
    .article-reader-container {
        margin-top: 0;
        padding-top: 70px; /* Space for fixed header */
        height: 100vh;
        box-sizing: border-box;
    }

    /* Hide presentation list panel by default on mobile */
    .presentation-list-panel {
        position: fixed;
        left: 0;
        top: 70px; /* Below fixed header */
        height: calc(100vh - 70px);
        z-index: 200;
        background: white;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
        flex: 0 0 280px !important;
        max-width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .presentation-list-panel:not(.collapsed) {
        transform: translateX(0);
    }

    .presentation-list-panel.collapsed {
        transform: translateX(-100%);
    }

    /* Adjust toggle button position for mobile */
    .presentation-list-panel .toggle-panel-btn {
        right: -35px;
        width: 35px;
        height: 50px;
        border-radius: 0 8px 8px 0;
    }

    /* Slide viewer takes full width on mobile */
    .slide-viewer-panel {
        flex: 1 1 100% !important;
        width: 100%;
        display: flex;
        flex-direction: column;
        overflow: visible; /* Changed from hidden to allow navigation to show */
        position: relative;
        height: 100%; /* Ensure full height */
    }

    /* Slide content optimized for mobile */
    .slide-content-wrapper {
        padding: 4px;
        gap: 0;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        padding-bottom: 100px; /* Space for fixed navigation */
        margin-bottom: 0;
    }

    .slide-viewer-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: visible; /* Allow sticky positioning to work */
        padding-bottom: 90px; /* Extra space for fixed navigation */
    }

    .slide-display {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: visible; /* Changed from hidden */
        padding: 0;
    }

    .current-slide-content {
        flex-direction: column;
        padding: 6px;
        gap: 8px;
    }

    /* Image column - optimized for mobile viewing */
    .slide-image-column {
        order: 1;
        width: 100%;
        max-width: 100%;
    }

    .slide-image-container {
        max-width: 100%;
        padding: 4px;
    }

    .slide-image-container img {
        max-height: 280px;
        width: 100%;
        object-fit: contain;
    }

    /* Text column - below image on mobile */
    .slide-text-column {
        order: 2;
        width: 100%;
    }

    /* Context panels - HIDE on mobile for cleaner view */
    .slide-context {
        display: none !important;
    }

    /* Caption container - more prominent, less padding */
    .slide-caption-container {
        padding: 8px;
        min-height: auto;
        border-left: 3px solid #007bff;
    }

    .slide-caption {
        font-size: 13px;
        line-height: 1.5;
    }

    /* Navigation buttons - optimized for mobile */
    .slide-navigation {
        display: flex;
        flex: 0 0 auto; /* Don't shrink, take natural height */
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: stretch;
        padding: 8px;
        gap: 8px;
        background: white;
        border-top: 2px solid #e9ecef;
        position: fixed; /* Changed from sticky to fixed */
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 500; /* Increased z-index */
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        min-height: 80px; /* Ensure minimum height for buttons */
    }

    .slide-navigation .slide-counter {
        font-size: 11px;
        order: -1;
        flex: 1 1 100%;
        text-align: center;
        margin-bottom: 4px;
    }

    .slide-navigation #jump-to-video-btn {
        order: 1;
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 11px;
        white-space: nowrap;
    }

    .slide-navigation #prev-slide-btn {
        order: 0;
        flex: 1 1 auto;
    }

    .slide-navigation #next-slide-btn {
        order: 2;
        flex: 1 1 auto;
    }

    .nav-btn {
        padding: 12px 16px;
        font-size: 13px;
        min-width: 0;
        font-weight: 600;
        background: #007bff;
        color: white;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s ease;
        min-height: 44px; /* Ensure touch-friendly target */
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }

    .nav-btn:hover:not(:disabled) {
        background: #0056b3;
    }

    .nav-btn:disabled {
        background: #6c757d;
        color: #f8f9fa;
        cursor: not-allowed;
        opacity: 0.8;
    }

    .nav-btn .icon {
        font-size: 11px;
    }

    /* Continue viewing section adjustments */
    .continue-presenting-section {
        padding: 10px;
    }

    .continue-presenting-section h3 {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .continue-viewing-item {
        padding: 8px;
        margin-bottom: 6px;
    }

    .continue-viewing-name {
        font-size: 12px;
    }

    .continue-viewing-progress {
        font-size: 10px;
    }

    .remove-continue-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }

    /* Presentation table adjustments */
    .presentation-table {
        font-size: 12px;
    }

    .presentation-table th,
    .presentation-table td {
        padding: 8px 6px;
    }

    /* Hide date and status columns on very small screens */
    .presentation-table th:nth-child(3),
    .presentation-table td:nth-child(3),
    .presentation-table th:nth-child(4),
    .presentation-table td:nth-child(4) {
        display: none;
    }

    /* Expand presentation list button */
    .expand-panel-btn {
        width: 35px;
        height: 50px;
        top: 40%;
    }

    /* Ensure proper layout without list panel visible */
    .presentation-main-content {
        position: relative;
    }

    /* Current slide container adjustments */
    .current-slide-container {
        border-width: 2px;
        border-radius: 6px;
    }

    /* Slide viewer panel - remove extra padding on mobile */
    .slide-viewer-panel {
        background: white;
    }

    .slide-display {
        padding: 0;
    }

    /* Minimize the overall slide container border on mobile */
    .current-slide-container {
        border: none;
        box-shadow: none;
        background: white;
        border-radius: 0;
    }

    /* Make slide content fill available space better */
    .slide-content-wrapper {
        max-width: 100%;
        background: white;
        padding: 0;
    }

    .current-slide-content {
        background: white;
    }
}
