/*
Theme Name: Tin học Văn phòng
Theme URI: https://tinhocvanphong.local
Author: Admin
Author URI: https://tinhocvanphong.local
Description: Hệ thống thi tin học văn phòng online - Word, Excel, PowerPoint
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tinhocvanphong
Tags: exam, education, quiz
*/

/* === DESIGN SYSTEM === */
:root {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-primary: #ef4444;
    --color-primary-light: #fee2e2;
    --color-primary-hover: #dc2626;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-dark: #0f172a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.12);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
}

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

body, input, button, select, textarea {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

body {
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.6;
}


/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}
.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(239,68,68,0.3);
}
.btn-primary:hover { background: var(--color-primary-hover); transform: translateY(-1px); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-outline {
    background: white;
    color: var(--color-text);
    border: 1.5px solid var(--color-border);
}
.btn-outline:hover { background: var(--color-bg); }
.btn-success { background: var(--color-success); color: white; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn-full { width: 100%; }

/* === CARDS === */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-body { padding: 32px; }

/* === FORMS === */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.form-control {
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--color-border);
    font-size: 16px;
    font-family: 'Courier New', monospace;
    text-align: center;
    outline: none;
    transition: all 0.2s;
    background: white;
    color: var(--color-text);
}
.form-control:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }

/* === ALERTS === */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; }
.alert-error { background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #10b981; border: 1px solid #bbf7d0; }
.alert-info { background: var(--color-primary-light); color: var(--color-primary); border: 1px solid #fca5a5; }

/* === HEADER === */
.site-header {
    background: white;
    border-bottom: 1px solid var(--color-border);
    padding: 0 32px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.header-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.header-right { display: flex; align-items: center; gap: 24px; }
.header-actions { display: flex; align-items: center; gap: 16px; margin-right: 8px; }

.action-icon {
    width: 51px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #64748b; cursor: pointer; transition: all 0.2s; position: relative;
}
.action-icon:hover { background: #f1f5f9; color: var(--color-primary); }
.action-icon svg { width: 28px; height: 28px; }

.unread-dot {
    position: absolute; top: 8px; right: 8px; width: 8px; height: 8px;
    background: #ef4444; border-radius: 50%; border: 2px solid white;
}

.user-profile-chip {
    display: flex; align-items: center; gap: 10px; background: #f8fafc;
    padding: 4px 4px 4px 14px; border-radius: 99px; border: 1px solid #e2e8f0;
    cursor: pointer; transition: all 0.2s;
}
.user-profile-chip:hover { border-color: #cbd5e1; background: #f1f5f9; }
.user-sbd { font-size: 13px; font-weight: 800; color: #1e293b; font-family: 'Courier New', monospace; letter-spacing: 0.05em; }
.user-avatar-wrap { width: 34px; height: 34px; border-radius: 50%; background: #fee2e2; display: flex; align-items: center; justify-content: center; overflow: hidden; }

.logout-btn {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8; background: none; border: none; cursor: pointer; transition: all 0.2s;
}
.logout-btn:hover { background: #fef2f2; color: #ef4444; }
.logout-btn svg { width: 20px; height: 20px; }

/* === BADGE === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger { background: #fee2e2; color: #ef4444; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-neutral { background: #f1f5f9; color: #64748b; }

/* === TABLE === */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--color-border); }
table { width: 100%; border-collapse: collapse; background: white; }
th { background: #f8fafc; padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--color-border); }
td { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* === LOADING SPINNER === */
.spinner {
    width: 22px; height: 22px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === MODAL === */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; padding: 16px;
    opacity: 0; visibility: hidden; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: white; border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%; max-width: 580px;
    max-height: 90vh; display: flex; flex-direction: column;
    transform: scale(0.9) translateY(20px); transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }

/* Modal Sizes */
.modal-sm { max-width: 420px; }
.modal-md { max-width: 580px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }

.modal-header { 
    padding: 24px 30px; 
    border-bottom: 1px solid var(--color-border); 
    display: flex; align-items: center; justify-content: space-between; 
    flex-shrink: 0;
}
.modal-body { 
    padding: 30px; 
    overflow-y: auto; 
    flex: 1;
    -webkit-overflow-scrolling: touch;
}
.modal-footer { 
    padding: 20px 30px; 
    border-top: 1px solid var(--color-border); 
    display: flex; justify-content: flex-end; gap: 12px; 
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .modal-overlay { padding: 12px; }
    .modal { border-radius: 24px; max-height: 94vh; }
    .modal-header { padding: 20px 24px; }
    .modal-body { padding: 24px; }
    .modal-footer { padding: 16px 24px; }
    
    /* Force smaller modals to be full width on mobile */
    .modal-sm, .modal-md, .modal-lg { max-width: 100%; }
}

/* === UTILITIES === */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.font-mono { font-family: 'Courier New', monospace; }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mt-4 { margin-top: 16px; }/* === DASHBOARD HEAD === */
.dashboard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 40px; gap: 20px; }
.dashboard-title { font-size: 32px; font-weight: 950; color: #0f172a; margin-bottom: 8px; letter-spacing: -0.04em; }
.dashboard-subtitle { font-size: 16px; color: #64748b; font-weight: 500; }

/* === NEW RESPONSIVE DASHBOARD GRID === */
.subject-grid { 
    display: grid !important; 
    grid-template-columns: repeat(3, 1fr) !important; 
    gap: 32px !important; 
    width: 100% !important;
}

@media (max-width: 1024px) {
    .subject-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 24px !important; }
}

@media (max-width: 640px) {
    .subject-grid { grid-template-columns: 1fr !important; gap: 20px !important; }
    .subject-card { padding: 30px 24px !important; border-radius: 24px !important; }
    .subject-name { font-size: 22px !important; }
}

/* === PROFESSIONAL RED ARROW CURSOR === */
* { cursor: none !important; }
.thvp-cursor {
    position: fixed; top: 0; left: 0; width: 32px; height: 32px;
    pointer-events: none; z-index: 10000000;
    transition: transform 0.1s ease-out;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.4));
    will-change: transform;
}
.thvp-cursor.hover {
    transform: scale(1.4);
    filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.6));
}
.thvp-cursor.legal-hover {
    transform: scale(1.6) rotate(-15deg);
}

@media (max-width: 1024px) {
    * { cursor: auto !important; }
    .thvp-cursor { display: none !important; }
}

/* === PAGE CONTENT === */
/* === SUBJECT CARDS - MODERN REDESIGN === */
.subject-card {
    background: white !important;
    border: 1px solid #f1f5f9 !important;
    border-radius: 32px !important;
    padding: 32px !important;
    cursor: default !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03) !important;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08) !important;
}

/* Card Badge - Top Right */
.card-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}
.badge-fail, .badge-violation { background: #fff1f2; color: #ef4444; }
.badge-pass { background: #f0fdf4; color: #10b981; }
.badge-pending { background: #f8fafc; color: #64748b; }
.badge-new { background: #f1f5f9; color: #94a3b8; }

/* Subject Header (Icon + Name) */
.subject-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}
.subject-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    flex-shrink: 0;
}
.subject-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}
.subject-name {
    font-size: 24px;
    font-weight: 950;
    color: #1e293b;
    margin: 0;
    line-height: 1.2;
}

/* Status Rows */
.subject-status-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.status-label-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.status-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}
.status-label {
    font-size: 15px;
    font-weight: 700;
    color: #334155;
}
.status-box {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
}
.status-box.red { background: #fff1f2; color: #ef4444; }
.status-box.gray { background: #f8fafc; color: #94a3b8; border: 1px solid #e2e8f0; }
.status-box.green { background: #f0fdf4; color: #10b981; }

/* Reopen Timer Block */
.reopen-timer {
    background: #fff7ed;
    border: 1px solid #ffedd5;
    border-radius: 16px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #9a3412;
    font-weight: 800;
    font-size: 15px;
}
.reopen-timer svg {
    color: #ea580c;
}

/* Action Button */
.card-action-btn {
    width: 100%;
    padding: 18px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: 900;
    text-transform: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-thi-ngay {
    background: #ef4444;
    color: white;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2);
}
.btn-thi-ngay:hover {
    background: #dc2626;
    transform: scale(1.02);
}
.btn-thi-lai-locked {
    background: #f1f5f9;
    color: #cbd5e1;
    cursor: not-allowed;
}

.locked-footer-text {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
    margin-top: -8px;
}

/* Overriding old styles */
.subject-card.done { opacity: 1; filter: none; }

/* === CURSOR ALIGNMENT FIX === */
.thvp-cursor {
    transform: translate(-3px, -2px); /* Offset to align SVG tip to mouse */
}

/* Footer Legal Links */
.legal-link {
    color: #64748b !important;
    text-decoration: none !important;
    transition: all 0.2s !important;
}
.legal-link:hover {
    color: #ef4444 !important;
}
