/* Video Library Styles */

.videos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.videos-header h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 600;
}

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

.view-toggle {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-toggle .btn {
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 8px 16px;
    font-size: 14px;
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.view-toggle .btn:last-child {
    border-right: none;
}

.view-toggle .btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.view-toggle .btn.active {
    background: var(--primary-color);
    color: white;
}

.view-toggle .btn i {
    margin-right: 6px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    width: 250px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.video-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.video-thumbnail {
    width: 100%;
    height: 200px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.video-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    font-family: monospace;
    pointer-events: none;
    z-index: 5;
}

.video-duration .duration-text {
    color: white;
}

.video-thumbnail:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.video-thumbnail:hover::before {
    content: '\f04b';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 48px;
    z-index: 1;
    pointer-events: none;
}

.video-info {
    padding: 1rem;
}

.video-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.video-size {
    font-size: 14px;
    color: var(--text-secondary);
}

.video-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.video-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.video-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-actions .btn i {
    margin-right: 4px;
}

/* Video Player Modal */
.video-modal {
    width: 90vw;
    max-width: 1200px;
    max-height: 90vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

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

.modal-actions .btn {
    padding: 8px 16px;
    font-size: 14px;
}

.modal-body {
    padding: 1.5rem;
}

.video-player-container {
    margin-bottom: 1.5rem;
}

.video-player-container video {
    width: 100%;
    height: auto;
    max-height: 60vh;
    border-radius: 8px;
    background: #000;
}

.video-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.info-item span {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-all;
}

/* States */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-state p {
    margin-top: 1rem;
    color: var(--text-secondary);
}

.error-state {
    text-align: center;
    padding: 4rem 2rem;
}

.error-state .error-icon {
    font-size: 48px;
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error-state h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.error-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state .empty-icon {
    font-size: 48px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .videos-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .view-toggle {
        align-self: flex-start;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
    }
    
    .video-modal {
        width: 95vw;
        max-height: 95vh;
    }
    
    .modal-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .modal-actions {
        justify-content: center;
    }
    
    .video-info {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
.google-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.google-loader .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color);
    animation: bounce 1.4s infinite ease-in-out both;
}

.google-loader .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.google-loader .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Transcription Modal Styles */
.video-info-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.video-info-section h3 {
    margin: 0 0 1rem 0;
    font-size: 16px;
    color: var(--text-primary);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

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

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.btn-close:hover {
    color: var(--text-primary);
    background: var(--bg-primary);
}

/* Video Table View */
.video-table {
    margin-top: 2rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.video-table table {
    width: 100%;
    border-collapse: collapse;
}

.video-table thead {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.video-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-right: 1px solid var(--border-color);
    user-select: none;
}

.video-table th:last-child {
    border-right: none;
}

.video-table th.sortable {
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.video-table th.sortable:hover {
    background: var(--bg-secondary);
}

.video-table th.sortable span {
    display: inline-block;
    margin-right: 8px;
}

.video-table th.sortable .sort-icon {
    font-size: 12px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.video-table th.sortable.sort-asc .sort-icon::before {
    content: '\f0de';
    color: var(--primary-color);
}

.video-table th.sortable.sort-desc .sort-icon::before {
    content: '\f0dd';
    color: var(--primary-color);
}

.video-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
    height: 100px; /* Larger row height for video previews */
}

.video-table tbody tr:last-child {
    border-bottom: none;
}

.video-table tbody tr:hover {
    background: var(--bg-primary);
}

.video-table td {
    padding: 1rem;
    border-right: 1px solid var(--border-color);
    vertical-align: middle;
    height: 100px; /* Match row height */
}

.video-table td:last-child {
    border-right: none;
}

.video-name {
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.2s;
}

.video-name:hover {
    color: var(--primary-color);
}

.video-size-cell {
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 14px;
}

.video-date-cell {
    color: var(--text-secondary);
    font-size: 14px;
    white-space: nowrap;
}

.video-duration-cell {
    color: var(--text-primary);
    font-family: monospace;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}


.preview-column {
    width: 160px;
    text-align: center;
}

.video-preview {
    width: 140px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.video-preview::after {
    content: '\f04b';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    opacity: 0.8;
    z-index: 10;
}

.video-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 6px;
    pointer-events: none;
}

.video-preview:hover .video-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.4);
}

.video-overlay i {
    color: white;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}


/* Context Menu */
.context-menu {
    position: absolute;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 150px;
    overflow: hidden;
}

.context-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: var(--bg-secondary);
}

.context-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--text-secondary);
}


/* Responsive adjustments for table */
@media (max-width: 768px) {
    .video-table {
        overflow-x: auto;
    }
    
    .video-table table {
        min-width: 600px;
    }
    
    .table-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .table-actions .btn {
        font-size: 11px;
        padding: 4px 8px;
    }
}