/* ========================================
   BASE STYLES
   ======================================== */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* ========================================
   HEADER
   ======================================== */

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

.header-brand h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.header-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

.header-nav {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
}

.btn-refresh {
    background: rgba(255, 193, 7, 0.3) !important;
    border-color: rgba(255, 193, 7, 0.5) !important;
}

.btn-refresh:hover {
    background: rgba(255, 193, 7, 0.5) !important;
    border-color: #ffc107 !important;
}

.btn-logout {
    background: rgba(244, 67, 54, 0.3) !important;
    border-color: rgba(244, 67, 54, 0.5) !important;
}

.btn-logout:hover {
    background: rgba(244, 67, 54, 0.5) !important;
    border-color: #f44336 !important;
}

/* ========================================
   CONTENT
   ======================================== */

.content {
    padding: 40px;
}

.list-header {
    margin-bottom: 30px;
}

.list-title h2 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 5px;
}

.list-description {
    color: #666;
    font-size: 0.95rem;
}

.list-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.search-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.sort-select,
.category-filter {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    background: white;
}

.sort-select:focus,
.category-filter:focus {
    outline: none;
    border-color: #667eea;
}

.filter-controls {
    margin: 0 10px;
}

/* ========================================
   TABLE - SIMPLE & CLEAN
   ======================================== */

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

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

.video-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.video-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.video-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
}

.video-table tbody tr:hover {
    background: #f5f5f5;
}

.video-table td {
    padding: 15px;
    vertical-align: top;
}

/* Kolom 1: Judul */
.video-table th:nth-child(1),
.video-table td:nth-child(1) {
    width: 25%;
}

/* Kolom 2: Kategori */
.video-table th:nth-child(2),
.video-table td:nth-child(2) {
    width: 12%;
}

/* Kolom 3: Deskripsi */
.video-table th:nth-child(3),
.video-table td:nth-child(3) {
    width: 28%;
}

/* Kolom 4: Tanggal */
.video-table th:nth-child(4),
.video-table td:nth-child(4) {
    width: 15%;
}

/* Kolom 5: Aksi */
.video-table th:nth-child(5),
.video-table td:nth-child(5) {
    width: 20%;
}

/* Video Title */
.video-title-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.3s;
    padding: 5px;
    margin: -5px;
    border-radius: 5px;
}

.video-title-link:hover {
    background: linear-gradient(135deg, #f0f4ff, #e6f0ff);
    transform: translateX(5px);
}

.video-title-link:hover strong {
    color: #667eea;
}

.video-title strong {
    display: block;
    font-size: 1.05rem;
    color: #333;
    margin-bottom: 5px;
    transition: color 0.3s;
}

.video-id {
    font-size: 0.8rem;
    color: #999;
    font-family: 'Courier New', monospace;
}

/* Video Description */
.video-description {
    color: #666;
    line-height: 1.5;
}

/* Category Badge */
.category-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.no-category {
    color: #ccc;
    font-style: italic;
    font-size: 0.9rem;
}

.category-cell {
    text-align: center;
}

/* Video Date */
.video-date {
    color: #666;
}

.video-time {
    display: block;
    font-size: 0.85rem;
    color: #999;
    margin-top: 3px;
}

/* ========================================
   ACTION BUTTONS - ICON ONLY
   ======================================== */

.action-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 5px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-action:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-play {
    background: #4CAF50;
}

.btn-play:hover {
    background: #45a049;
}

.btn-edit {
    background: #2196F3;
}

.btn-edit:hover {
    background: #0b7dda;
}

.btn-share {
    background: #FF9800;
}

.btn-share:hover {
    background: #e68900;
}

.btn-delete {
    background: #f44336;
}

.btn-delete:hover {
    background: #da190b;
}

/* ========================================
   MODAL
   ======================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 600px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 30px;
}

.modal-body.center {
    text-align: center;
}

.qr-description {
    margin-top: 15px;
    color: #666;
    font-size: 0.9rem;
}

/* ========================================
   FORM STYLES
   ======================================== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.btn-primary {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    padding: 12px 24px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.no-videos {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-videos h2 {
    color: #333;
    margin-bottom: 10px;
}

.no-videos p {
    color: #666;
    margin-bottom: 30px;
}

.btn-success {
    display: inline-block;
    padding: 12px 24px;
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-success:hover {
    background: #45a049;
    transform: translateY(-2px);
}

/* ========================================
   ALERT
   ======================================== */

.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert.error {
    background: #ffebee;
    color: #c62828;
    border-left-color: #c62828;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .list-controls {
        flex-direction: column;
    }
    
    .content {
        padding: 20px;
    }
    
    .video-table th,
    .video-table td {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-action {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   LOADING & TOAST
   ======================================== */

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

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.toast {
    background: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: #4CAF50;
}

.toast.error {
    border-left-color: #f44336;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* ========================================
   PAGINATION
   ======================================== */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    margin-top: 20px;
}

.pagination-info {
    color: #666;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 5px;
}

.page-btn {
    padding: 8px 12px;
    background: white;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.page-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

.page-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    font-weight: 600;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}
