/* ===== YSync Design System — Light Professional ===== */
:root {
    --bg-primary: #f4f6f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --border-glass: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --radius: 4px;
    --radius-lg: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease-in-out;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); text-decoration: underline; }

h1:focus { outline: none; }

/* ===== Loading Screen ===== */
.loading-screen {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; gap: 2rem;
    background: var(--bg-primary);
}
.loading-logo { font-size: 3rem; font-weight: 800; }
.loading-logo-y { color: var(--accent); }
.loading-logo-sync { color: var(--text-primary); }
.loading-spinner { width: 48px; height: 48px; }
.spinner-ring {
    width: 48px; height: 48px; border-radius: 50%;
    border: 3px solid var(--border-glass); border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-secondary); font-size: 0.9rem; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.625rem 1.25rem; border-radius: var(--radius);
    font-family: var(--font); font-size: 0.875rem; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; transition: var(--transition);
    text-decoration: none; line-height: 1.4;
}
.btn-primary {
    background: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }
.btn-ghost {
    background: transparent; color: var(--text-primary);
    border: 1px solid var(--border-glass);
}
.btn-ghost:hover { background: #f1f5f9; text-decoration: none; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Cards ===== */
.card {
    background: var(--bg-card); border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg); padding: 1.5rem;
    box-shadow: var(--shadow); transition: var(--transition);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-title { font-size: 1.1rem; font-weight: 600; }

/* ===== Stats Card ===== */
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg); padding: 1.5rem;
    box-shadow: var(--shadow); transition: var(--transition);
    border-top: 3px solid var(--accent);
}
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius);
    background: #fff7ed; display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem; font-size: 1.5rem; border: 1px solid #ffedd5;
}
.stat-value { font-size: 2rem; font-weight: 800; margin-bottom: 0.25rem; color: var(--text-primary); }
.stat-label { color: var(--text-secondary); font-size: 0.85rem; font-weight: 500; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.5rem; }
.form-input, .form-select {
    width: 100%; padding: 0.75rem 1rem; font-size: 0.9rem;
    font-family: var(--font); color: var(--text-primary);
    background: #ffffff; border: 1px solid #cbd5e1;
    border-radius: var(--radius); transition: var(--transition);
    outline: none;
}
.form-input:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #fed7aa; }
.form-input::placeholder { color: var(--text-muted); }
.form-error { color: var(--danger); font-size: 0.8rem; margin-top: 0.25rem; }

/* ===== Auth Pages ===== */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg-primary);
    padding: 1rem;
}
.auth-card {
    width: 100%; max-width: 420px; padding: 2.5rem;
    background: var(--bg-card); border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo-text { font-size: 2.5rem; font-weight: 800; }
.auth-logo-y { color: var(--accent); }
.auth-logo-sync { color: var(--text-primary); }
.auth-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.95rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-secondary); font-size: 0.85rem; }
.auth-footer a { color: var(--accent); font-weight: 600; }

/* ===== Alert ===== */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.85rem; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ===== Tables ===== */
.table-container { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-glass); background: var(--bg-card); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 0.875rem 1rem; font-size: 0.75rem; font-weight: 700;
    color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em;
    background: #f8fafc; border-bottom: 1px solid var(--border-glass);
}
.data-table td {
    padding: 0.875rem 1rem; font-size: 0.875rem; border-bottom: 1px solid var(--border-glass);
}
.data-table tr:hover td { background: #f1f5f9; }
.data-table tr:last-child td { border-bottom: none; }

/* ===== Status Badge ===== */
.badge {
    display: inline-flex; align-items: center; padding: 0.25rem 0.75rem;
    border-radius: var(--radius); font-size: 0.75rem; font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-admin { display: inline-flex; align-items: center; padding: 0.2rem 0.6rem; border-radius: var(--radius); font-size: 0.75rem; font-weight: 600; background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.badge-user  { display: inline-flex; align-items: center; padding: 0.2rem 0.6rem; border-radius: var(--radius); font-size: 0.75rem; font-weight: 600; background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* ===== Modal/Dialog ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem;
    animation: fadeIn 0.2s ease;
}
.modal-content {
    background: var(--bg-secondary); border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg); padding: 2rem; width: 100%; max-width: 480px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease;
}
.modal-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; color: var(--text-primary); }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ===== Grid Helpers ===== */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.flex { display: flex; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { gap: 0.75rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.85rem; }

/* ===== Page Header ===== */
.page-header { margin-bottom: 2rem; }
.page-title { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.25rem; color: var(--text-primary); }
.page-subtitle { color: var(--text-secondary); font-size: 0.95rem; }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 1.5rem; right: 1.5rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
    padding: 0.875rem 1.25rem; border-radius: var(--radius);
    background: #ffffff; box-shadow: var(--shadow);
    font-size: 0.875rem; font-weight: 600;
    animation: slideInRight 0.3s ease; min-width: 280px;
    display: flex; align-items: center; gap: 0.5rem;
}
.toast-success { color: #16a34a; border-left: 4px solid #16a34a; }
.toast-error { color: #dc2626; border-left: 4px solid #dc2626; }

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
.fade-in { animation: fadeIn 0.3s ease; }
.slide-up { animation: slideUp 0.3s ease; }

/* ===== Blazor Error UI ===== */
#blazor-error-ui {
    background: #fee2e2; color: #991b1b;
    bottom: 0; box-shadow: var(--shadow); display: none; left: 0;
    padding: 0.6rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-secondary); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state-text { font-size: 1rem; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }