/* assets/css/admin.css */
:root {
    --bg-dark: #0f1117;
    --bg-card: #181b24;
    --bg-input: #222634;
    --border-color: #2b3042;
    --primary: #fe2c55;
    --primary-hover: #e02449;
    --primary-light: rgba(254, 44, 85, 0.15);
    --text-main: #f1f3f9;
    --text-muted: #8c93a8;
    --success: #10b981;
    --danger: #ef4444;
    --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Login Page Styling */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 36px 32px;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.logo-area {
    text-align: center;
    margin-bottom: 28px;
}

.logo-badge {
    background: linear-gradient(135deg, #fe2c55 0%, #25f4ee 100%);
    color: #fff;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 8px;
    display: inline-block;
    letter-spacing: 1px;
    font-size: 14px;
    margin-bottom: 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.logo-area h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.logo-area p {
    color: var(--text-muted);
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 14px 24px;
    font-size: 15px;
    width: 100%;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.1);
}

.login-footer {
    margin-top: 20px;
    text-align: center;
}

.login-footer a {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}

.login-footer a:hover {
    color: var(--text-main);
}

/* Admin Dashboard Layout - Full Width */
.admin-wrapper {
    max-width: 100%;
    margin: 0;
    padding: 20px 28px 60px;
    width: 100%;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand h1 {
    font-size: 20px;
    font-weight: 700;
}

.brand h1 span {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 16px;
    margin-left: 6px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-video { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.icon-views { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.icon-shares { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

/* Cards & Sections */
.admin-main {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    width: 100%;
}

@media (max-width: 992px) {
    .admin-main {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
}

.card-header {
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.card-header p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Drop Zone */
.drop-zone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 24px 16px;
    text-align: center;
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.2s ease;
}

.drop-zone.drag-over,
.drop-zone:hover {
    border-color: var(--primary);
    background: rgba(254, 44, 85, 0.04);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.drop-zone-prompt svg {
    color: var(--text-muted);
    margin-bottom: 8px;
}

.drop-zone-prompt .primary-text {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.drop-zone-prompt .primary-text span {
    color: var(--primary);
}

.drop-zone-prompt .secondary-text {
    font-size: 12px;
    color: var(--text-muted);
}

.file-info {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: var(--border-color);
}

.badge-id {
    color: var(--text-muted);
}

.required {
    color: var(--primary);
}

/* Progress Bar */
.progress-container {
    margin: 16px 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
    font-weight: 500;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fe2c55, #25f4ee);
    border-radius: 4px;
    transition: width 0.15s ease;
}

/* Alerts */
.alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #86efac;
}

.hidden {
    display: none !important;
}

/* Table - Hỗ trợ kéo ngang trên Mobile */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.video-table {
    width: 100%;
    min-width: 720px; /* Đảm bảo trên mobile nhỏ kéo ngang trơn tru, không bị co nát */
    border-collapse: collapse;
    font-size: 14px;
}

.video-table th {
    text-align: left;
    padding: 12px 14px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.video-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.video-title-cell strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-main);
}

.video-title-cell .filename {
    font-size: 12px;
    color: var(--text-muted);
}

.mini-preview {
    width: 110px;
    height: 62px;
    border-radius: 6px;
    background: #000;
    object-fit: cover;
}

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

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-delete {
    color: var(--danger);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.15);
}

.empty-state {
    padding: 40px !important;
    color: var(--text-muted);
}

/* 2FA TOTP Styling */
.totp-status-box {
    padding: 20px;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
}

.totp-status-box.active-2fa {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.05);
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

/* Post Type Selector Pills */
.post-type-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.type-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.type-pill:hover {
    color: #fff;
    border-color: rgba(254, 44, 85, 0.4);
}

.type-pill.active {
    background: linear-gradient(135deg, rgba(254, 44, 85, 0.2), rgba(37, 244, 238, 0.1));
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(254, 44, 85, 0.25);
}

.textarea-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    font-size: 14px;
    resize: vertical;
    min-height: 65px;
}

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

.help-text {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

.badge-type-video {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 4px;
}

.badge-type-photo {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.3);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 4px;
}

.mini-preview-img {
    width: 60px;
    height: 75px;
    object-fit: cover;
    border-radius: 6px;
    background: #000;
    border: 1px solid var(--border-color);
}

/* Nút Xem Bài Đăng trong tab mới (Chỉ icon play nhỏ gọn) */
.btn-watch-link {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(37, 244, 238, 0.12);
    border: 1px solid rgba(37, 244, 238, 0.35);
    color: #25f4ee;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-watch-link:hover {
    background: #25f4ee;
    color: #0f1117;
    transform: scale(1.12);
    box-shadow: 0 0 12px rgba(37, 244, 238, 0.5);
}

/* Nút Chỉnh Sửa */
.btn-edit {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 6px;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit:hover {
    background: #38bdf8;
    color: #0f1117;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

/* Modal Chỉnh Sửa Bài Đăng */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.hidden {
    display: none !important;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    animation: modalFadeIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-body-scroll {
    overflow-y: auto;
    padding: 20px 24px;
    flex: 1;
}

/* Photo Gallery Manager trong Modal Edit */
.edit-section-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.edit-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.edit-section-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-section-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.4;
}

.photo-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.photo-item-card {
    position: relative;
    background: #111;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    aspect-ratio: 9/12;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.photo-item-card:hover {
    border-color: var(--primary-cyan);
    transform: translateY(-2px);
}

.photo-item-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-item-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.photo-item-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 4px 6px;
    z-index: 3;
}

.btn-photo-action {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.btn-photo-action:hover:not(:disabled) {
    background: var(--primary-red);
    transform: scale(1.1);
}

.btn-photo-action.btn-move:hover:not(:disabled) {
    background: var(--primary-cyan);
    color: #000;
}

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

/* Audio Manager trong Modal Edit */
.audio-current-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.audio-current-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #a7f3d0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-preview-player {
    height: 28px;
    max-width: 150px;
}

.btn-remove-audio {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove-audio:hover {
    background: #ef4444;
    color: #fff;
}

.audio-deleted-badge {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.btn-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-modal-close:hover {
    color: #fff;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .admin-wrapper {
        padding: 14px 10px 50px;
    }
    .admin-header {
        padding-bottom: 16px;
        margin-bottom: 16px;
    }
    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }
    .card {
        padding: 16px 12px;
    }
}

