/* ═══════════════════════════════════════════════════════════════════════════
   MultiZlogin — Shared Design System
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fb;
    --bg-tertiary: #eef0f4;
    --bg-hover: #f0f2f5;
    --bg-active: #e8f0fe;
    --text-primary: #1a1c1e;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;
    --border-color: #e4e6eb;
    --accent: #0068ff;
    --accent-light: #e8f0fe;
    --accent-hover: #0052cc;
    --accent-gradient: linear-gradient(135deg, #0068ff 0%, #4d9fff 100%);
    --danger: #ea4335;
    --danger-hover: #d93025;
    --danger-light: #fce8e6;
    --success: #34a853;
    --success-light: #e6f4ea;
    --warning: #f9ab00;
    --warning-light: #fef7e0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.12);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms cubic-bezier(.4,0,.2,1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
    --bg-primary: #1c1c2e;
    --bg-secondary: #151521;
    --bg-tertiary: #111118;
    --bg-hover: #242436;
    --bg-active: #2a2a42;
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b4;
    --text-muted: #6c6c80;
    --border-color: #2a2a3e;
    --accent: #5ea3ff;
    --accent-light: #1e3050;
    --accent-hover: #7db8ff;
    --accent-gradient: linear-gradient(135deg, #5ea3ff 0%, #8abfff 100%);
    --danger: #f28b82;
    --danger-hover: #e67c73;
    --danger-light: #3a2020;
    --success: #81c995;
    --success-light: #1a3525;
    --warning: #fdd663;
    --warning-light: #352a15;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,.25);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.4);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #1c1c2e;
        --bg-secondary: #151521;
        --bg-tertiary: #111118;
        --bg-hover: #242436;
        --bg-active: #2a2a42;
        --text-primary: #e8e8f0;
        --text-secondary: #a0a0b4;
        --text-muted: #6c6c80;
        --border-color: #2a2a3e;
        --accent: #5ea3ff;
        --accent-light: #1e3050;
        --accent-hover: #7db8ff;
        --accent-gradient: linear-gradient(135deg, #5ea3ff 0%, #8abfff 100%);
        --danger: #f28b82;
        --danger-hover: #e67c73;
        --danger-light: #3a2020;
        --success: #81c995;
        --success-light: #1a3525;
        --warning: #fdd663;
        --warning-light: #352a15;
        --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
        --shadow-md: 0 4px 16px rgba(0,0,0,.25);
        --shadow-lg: 0 12px 40px rgba(0,0,0,.4);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════════════════════════════════════ */

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

body {
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   App Header
   ═══════════════════════════════════════════════════════════════════════════ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .app-header {
    background: rgba(28,28,46,.82);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
    color: var(--text-primary);
    font-weight: 800;
    font-size: 19px;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}

.app-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: #fff;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(0,104,255,.3);
}

.header-spacer { flex: 1; }

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

.header-back {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: color var(--transition-fast);
}
.header-back:hover { color: var(--accent); }

@media (max-width: 768px) {
    .app-header { padding: 10px 14px; gap: 8px; }
    .app-logo { font-size: 16px; }
    .app-logo-icon { width: 32px; height: 32px; font-size: 16px; }
    .header-back span { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1;
}

.btn-accent {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,104,255,.25);
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,104,255,.35); }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); transform: translateY(-1px); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }

.btn-block { width: 100%; }

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    font-family: var(--font-family);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

button:disabled, .btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Container
   ═══════════════════════════════════════════════════════════════════════════ */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
}

.container-sm { max-width: 520px; }

@media (max-width: 768px) {
    .container { padding: 20px 14px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Page Title
   ═══════════════════════════════════════════════════════════════════════════ */

.page-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

@media (max-width: 768px) {
    .page-title { font-size: 22px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: transparent;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 16px;
}

.card-body { padding: 22px; }

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Forms
   ═══════════════════════════════════════════════════════════════════════════ */

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    transition: all var(--transition-fast);
    line-height: 1.4;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-primary);
}

.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0a6' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-inline { display: flex; gap: 10px; }
.form-inline .form-input { flex: 1; }

@media (max-width: 768px) {
    .form-inline { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Alerts
   ═══════════════════════════════════════════════════════════════════════════ */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.alert-success { background: var(--success-light); color: var(--success); border: 1px solid var(--success); }
.alert-error   { background: var(--danger-light);  color: var(--danger);  border: 1px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning); }
.alert-info    { background: var(--accent-light);  color: var(--accent);  border: 1px solid var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   Tables
   ═══════════════════════════════════════════════════════════════════════════ */

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ═══════════════════════════════════════════════════════════════════════════
   Tabs
   ═══════════════════════════════════════════════════════════════════════════ */

.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

@media (max-width: 768px) {
    .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .tab-btn { white-space: nowrap; padding: 8px 14px; font-size: 12px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Empty State
   ═══════════════════════════════════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: .4;
}

.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 14px; max-width: 360px; margin: 0 auto; }

/* ═══════════════════════════════════════════════════════════════════════════
   Badges
   ═══════════════════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-xl);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--accent-light);  color: var(--accent); }
.badge-muted   { background: var(--bg-tertiary);   color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   Code blocks
   ═══════════════════════════════════════════════════════════════════════════ */

pre {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 12.5px;
    line-height: 1.6;
    border: 1px solid var(--border-color);
}

code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12.5px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

pre code { background: none; padding: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════════════════════ */

.app-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Utilities
   ═══════════════════════════════════════════════════════════════════════════ */

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 10px; }

/* ═══════════════════════════════════════════════════════════════════════════
   Two-column layout
   ═══════════════════════════════════════════════════════════════════════════ */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
}
