/* ============================================================
   Syrus Platform — Base CSS (Sales Design System)
   ============================================================ */

/* ── CSS Variables ────────────────────────────────────────── */

:root {
    --color-bg-base: #FFFFFF;
    --color-bg-subtle: #F8FAFC;
    --color-bg-muted: #F1F5F9;
    --color-bg-emphasis: #E2E8F0;
    --color-brand-primary: #1B3A5C;
    --color-brand-accent: #2E75B6;
    --color-brand-light: #EBF3FB;
    --color-brand-hover: #1A5FA8;
    --color-text-primary: #0F172A;
    --color-text-secondary: #475569;
    --color-text-muted: #94A3B8;
    --color-text-disabled: #CBD5E1;
    --color-border-default: #E2E8F0;
    --color-border-strong: #CBD5E1;
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: #3B82F6;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
    --sidebar-width: 240px;
    --top-header-height: 56px;
}

/* ── Reset ────────────────────────────────────────────────── */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    background: var(--color-bg-subtle);
    line-height: 1.5;
    min-height: 100vh;
}

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

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

img {
    max-width: 100%;
    display: block;
}

/* ── Focus visibility ────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--color-brand-accent);
    outline-offset: 2px;
}

.btn:focus-visible {
    outline: 2px solid var(--color-brand-accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--color-brand-light);
}

.sidebar .nav-link:focus-visible {
    outline: 2px solid var(--color-brand-accent);
    outline-offset: -2px;
    background: var(--color-bg-subtle);
}

.form-control:focus-visible {
    border-color: var(--color-brand-accent);
    box-shadow: 0 0 0 3px rgba(46, 117, 182, 0.15);
}

/* ── Sidebar ──────────────────────────────────────────────── */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-bg-base);
    border-right: 1px solid var(--color-border-default);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.2s ease;
}

.sidebar-logo {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border-default);
}

.sidebar-logo img {
    max-height: 50px;
    width: auto;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.sidebar-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding: 0 20px;
    margin-bottom: 8px;
}

.sidebar .nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar .nav-item {
    margin: 0;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.sidebar .nav-link:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-subtle);
    text-decoration: none;
}

.sidebar .nav-link.active {
    color: var(--color-brand-accent);
    background: var(--color-brand-light);
    border-left-color: var(--color-brand-accent);
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border-default);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.sidebar-user:hover {
    background: var(--color-bg-subtle);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-brand-light);
    color: var(--color-brand-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-dropdown {
    display: none;
    position: absolute;
    bottom: 70px;
    left: 16px;
    right: 16px;
    background: var(--color-bg-base);
    border: 1px solid var(--color-border-default);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 210;
    overflow: hidden;
}

.sidebar-user-dropdown.open {
    display: block;
}

.sidebar-user-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--color-text-secondary);
    transition: background 0.15s ease;
}

.sidebar-user-dropdown a:hover {
    background: var(--color-bg-subtle);
    text-decoration: none;
    color: var(--color-text-primary);
}

.sidebar-user-dropdown a.text-danger {
    color: var(--color-error);
}

.sidebar-user-dropdown a.text-danger:hover {
    background: #FEF2F2;
    color: var(--color-error);
}

/* ── Top Header ───────────────────────────────────────────── */

.top-header {
    position: sticky;
    top: 0;
    height: var(--top-header-height);
    background: var(--color-bg-base);
    border-bottom: 1px solid var(--color-border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

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

.top-header-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

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

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--color-text-secondary);
    font-size: 1.25rem;
    transition: background 0.15s ease;
}

.sidebar-toggle:hover {
    background: var(--color-bg-muted);
}

/* ── Main Layout ──────────────────────────────────────────── */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-container {
    padding: 24px;
}

/* ── Cards ────────────────────────────────────────────────── */

.card {
    background: var(--color-bg-base);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 24px;
    border: none;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-default);
    background: none;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

/* Stat Cards */
.stat-card {
    background: var(--color-bg-base);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 20px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card-icon.blue {
    background: var(--color-brand-light);
    color: var(--color-brand-accent);
}

.stat-card-icon.green {
    background: #D1FAE5;
    color: var(--color-success);
}

.stat-card-icon.yellow {
    background: #FEF3C7;
    color: var(--color-warning);
}

.stat-card-icon.red {
    background: #FEE2E2;
    color: var(--color-error);
}

.stat-card-body {
    flex: 1;
}

.stat-card-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.2;
}

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.5;
}

.btn:hover {
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--color-bg-base);
    color: var(--color-text-secondary);
    border-color: var(--color-border-strong);
}

.btn-secondary:hover {
    background: var(--color-bg-subtle);
    color: var(--color-text-primary);
}

.btn-outline-primary {
    background: transparent;
    color: var(--color-brand-accent);
    border-color: var(--color-brand-accent);
}

.btn-outline-primary:hover {
    background: var(--color-brand-accent);
    color: #fff;
}

.btn-danger {
    background: var(--color-error);
    color: #fff;
    border-color: var(--color-error);
}

.btn-danger:hover {
    background: #DC2626;
    border-color: #DC2626;
    color: #fff;
}

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

.btn-success:hover {
    background: #059669;
    border-color: #059669;
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8125rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--color-border-default);
    color: var(--color-text-secondary);
}

.btn-icon:hover {
    background: var(--color-bg-subtle);
    color: var(--color-text-primary);
}

/* ── Forms ─────────────────────────────────────────────────── */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label,
.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border-default);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    background: var(--color-bg-base);
    transition: all 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-brand-accent);
    box-shadow: 0 0 0 3px rgba(46, 117, 182, 0.15);
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border-default);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    background: var(--color-bg-base);
    transition: all 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-brand-accent);
    box-shadow: 0 0 0 3px rgba(46, 117, 182, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-muted);
}

.input-group {
    position: relative;
    display: flex;
    align-items: stretch;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    background: var(--color-bg-muted);
    border: 1px solid var(--color-border-default);
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.input-group .form-control,
.input-group input {
    border-radius: 0 8px 8px 0;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    padding: 0;
    border-radius: 4px;
    accent-color: var(--color-brand-accent);
}

.form-check label {
    font-size: 0.875rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-text-secondary);
    cursor: pointer;
}

/* ── Alerts / Flash Messages ──────────────────────────────── */

.flash-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border-color: #A7F3D0;
}

.alert-danger {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #FECACA;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border-color: #FDE68A;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border-color: #BFDBFE;
}

.alert i {
    margin-right: 8px;
}

.alert .btn-close,
.alert-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.6;
    color: inherit;
    padding: 0;
}

.alert .btn-close:hover,
.alert-dismiss:hover {
    opacity: 1;
}

/* ── Tables ───────────────────────────────────────────────── */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-bg-base);
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-default);
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg-subtle);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table tbody tr:hover {
    background: var(--color-bg-subtle);
}

.table-card {
    background: var(--color-bg-base);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-card .table {
    margin: 0;
}

.table-card .table th:first-child,
.table-card .table td:first-child {
    padding-left: 24px;
}

.table-card .table th:last-child,
.table-card .table td:last-child {
    padding-right: 24px;
}

/* ── Auth Layout ──────────────────────────────────────────── */

.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg-subtle);
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: var(--color-bg-base);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 40px 32px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    margin-bottom: 16px;
}

.auth-logo img {
    max-height: 44px;
    margin: 0 auto;
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-brand-primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* ── Error Pages ──────────────────────────────────────────── */

.error-page {
    text-align: center;
    padding: 80px 24px;
}

.error-page-code {
    font-size: 6rem;
    font-weight: 800;
    color: var(--color-brand-accent);
    line-height: 1;
    margin-bottom: 8px;
}

.error-page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

.error-page p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
    font-size: 1rem;
}

/* ── Badges ───────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.badge-primary {
    background: var(--color-brand-light);
    color: var(--color-brand-accent);
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-secondary {
    background: var(--color-bg-muted);
    color: var(--color-text-secondary);
}

/* ── Utilities ────────────────────────────────────────────── */

.text-primary { color: var(--color-text-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-muted { color: var(--color-text-muted) !important; }
.text-danger { color: var(--color-error) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-brand { color: var(--color-brand-accent) !important; }
.text-center { text-align: center; }

.bg-base { background: var(--color-bg-base); }
.bg-subtle { background: var(--color-bg-subtle); }
.bg-muted { background: var(--color-bg-muted); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.p-0 { padding: 0; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

.w-100 { width: 100%; }

.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

/* ── Sidebar Overlay (mobile) ─────────────────────────────── */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 190;
}

.sidebar-overlay.active {
    display: block;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-md);
    }

    .main-content {
        margin-left: 0;
    }

    .content-container {
        padding: 16px;
    }

    .top-header {
        padding: 0 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stat-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Grid helpers ─────────────────────────────────────────── */

.stat-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
}

.col {
    flex: 1;
    padding: 0 12px;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 12px;
}

@media (max-width: 768px) {
    .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ── Badge Variants (shared across services) ─────────────────── */

.badge-priority-high {
    background: #FEE2E2;
    color: #991B1B;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.badge-priority-medium {
    background: #FEF3C7;
    color: #92400E;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.badge-priority-low {
    background: var(--color-bg-muted);
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

/* ── Progress Bar (shared) ───────────────────────────────────── */

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--color-bg-muted);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--color-brand-accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-bar-fill.complete {
    background: var(--color-success);
}

.progress-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
}
