/**
 * base.css — Shared Design System
 * Used by both portal (diemdanh.php) and admin (admin.php)
 */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #4f46e5;
    --secondary-hover: #4338ca;
    --teams-blue: #4650b6;
    --teams-blue-hover: #3b449b;
    --sky-blue: #0ea5e9;
    --sky-blue-hover: #0284c7;
    --mint-green: #10b981;
    --mint-green-hover: #059669;
    --mint-bg: #ecfdf5;
    --web-gradient: linear-gradient(135deg, #4f46e5, #7c3aed);
    --app-gradient: linear-gradient(135deg, #4650b6, #6264a7);
    --fallback-gradient: linear-gradient(135deg, #0ea5e9, #38bdf8);

    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;

    /* Legacy mapping for compatibility */
    --bg: var(--bg-body);
    --card-bg: var(--bg-surface);
    --border: var(--border-color);
    --text: var(--text-main);
    --muted: var(--text-muted);
    --accent: var(--secondary);
    --makeup: #7c3aed;
    --success: var(--mint-green);
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: var(--sky-blue);
    --glass: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 12px rgba(79, 70, 229, 0.08), 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 10px 25px -5px rgba(37, 99, 235, 0.15), 0 8px 10px -6px rgba(37, 99, 235, 0.1);
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* PANEL */
.panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--glass);
    margin-bottom: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.6rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* BUTTONS */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem; padding: 0.6rem 1.2rem; border-radius: var(--radius-md);
    font-size: 0.88rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none; text-decoration: none; min-height: 38px; white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary {
    background: var(--web-gradient);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
    filter: brightness(1.08);
}
.btn-secondary {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}
.btn-success {
    background: var(--success);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
    filter: brightness(1.08);
}
.btn-danger {
    background: var(--danger);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
    filter: brightness(1.08);
}
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; min-height: 32px; }
.btn-block { width: 100%; }

/* FORMS */
.form-group { margin-bottom: 0.75rem; }
.form-label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.25rem; font-weight: 500; }
.form-control {
    width: 100%; padding: 0.55rem 0.75rem;
    background: #ffffff; border: 1px solid #cbd5e1;
    border-radius: 0.375rem; color: var(--text); font-size: 0.9rem;
    outline: none; transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
select.form-control option { background: #ffffff; color: var(--text); }

/* BADGES */
.badge { display: inline-flex; padding: 0.2rem 0.5rem; border-radius: 9999px; font-size: 0.72rem; font-weight: 600; border: 1px solid transparent; }
.badge-success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge-danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-makeup { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.badge-info { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }

/* TABLES */
.table-responsive { width: 100%; overflow-x: auto; border-radius: 0.5rem; border: 1px solid var(--border); background: #ffffff; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
th { background: #f1f5f9; color: #475569; font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* MODAL */
.modal { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; padding: 1rem; }
.modal.open { display: flex; }
.modal-dialog {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    max-width: 460px;
    width: 100%;
    padding: 1.25rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    opacity: 0;
    transform: scale(0.92);
}
.modal.open .modal-dialog {
    animation: modalZoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes modalZoomIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; padding: 0 0.25rem; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* ALERTS */
#alert-container { position: fixed; top: 5rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.35rem; max-width: 320px; width: calc(100% - 2rem); }
.alert-box { padding: 0.65rem 0.85rem; border-radius: 0.375rem; font-size: 0.86rem; font-weight: 500; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; animation: slideIn 0.25s ease forwards; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.alert-success { background: linear-gradient(135deg, #059669, #10b981); }
.alert-error { background: linear-gradient(135deg, #dc2626, #ef4444); }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(110%); opacity: 0; } }

/* UTILITIES */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
code { background: #f1f5f9; color: #0f172a; padding: 0.12rem 0.35rem; border-radius: 0.3rem; font-size: 0.82rem; font-family: monospace; border: 1px solid #e2e8f0; }
footer { text-align: center; padding: 1rem 1rem calc(1rem + var(--safe-bottom)); font-size: 0.78rem; color: var(--muted); border-top: 1px solid var(--border); margin-top: auto; }

/* SEARCH BAR */
.search-bar { position: relative; }
.search-bar input { padding-left: 2.4rem; }
.search-bar svg { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); width: 1rem; height: 1rem; color: var(--muted); pointer-events: none; }
