/**
 * Evenmatix Design System
 * Canonical brand tokens — aligned with the landing page (blue → cyan gradient)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Brand colors */
    --color-primary: #2563EB;
    --color-primary-dark: #1D4ED8;
    --color-primary-light: #3B82F6;
    --color-secondary: #06B6D4;
    --color-secondary-dark: #0891B2;
    --color-accent: #579BFC;

    /* Semantic colors */
    --color-success: #00C875;
    --color-success-dark: #047857;
    --color-success-bg: #ECFDF5;
    --color-success-border: #A7F3D0;

    --color-warning: #FDAB3D;
    --color-warning-dark: #B45309;
    --color-warning-bg: #FFFBEB;
    --color-warning-border: #FDE68A;

    --color-danger: #E62965;
    --color-danger-dark: #BE123C;
    --color-danger-bg: #FFF1F2;
    --color-danger-border: #FECDD3;

    --color-info: #579BFC;
    --color-info-bg: #E5F2FF;

    /* Neutrals */
    --color-dark: #181B34;
    --color-text-primary: #111827;
    --color-text-secondary: #6B7280;
    --color-text-muted: #9CA3AF;
    --color-bg: #FFFFFF;
    --color-bg-subtle: #F6F7FB;
    --color-surface: #FFFFFF;
    --color-border: #E5E7EB;
    --color-border-light: #F3F4F6;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
    --gradient-primary-hover: linear-gradient(135deg, #1D4ED8 0%, #0891B2 100%);
    --gradient-stat: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(37, 99, 235, 0.12);
    --shadow-xl: 0 10px 25px rgba(37, 99, 235, 0.15);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(37, 99, 235, 0.06);
    --shadow-card-hover: 0 4px 16px rgba(37, 99, 235, 0.14);

    /* Spacing */
    --input-height: 2.75rem;
    --btn-height: 2.75rem;
    --btn-height-sm: 2.25rem;
    --btn-height-lg: 3rem;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ── Base ── */
body {
    font-family: var(--font-family);
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ── */
.ds-page-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--color-dark);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.ds-section-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-dark);
    letter-spacing: -0.01em;
}

.ds-card-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-dark);
}

.ds-body {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.ds-small {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.ds-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.ds-link {
    color: var(--color-primary);
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.ds-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* ── Gradient utilities ── */
.gradient-primary {
    background: var(--gradient-primary) !important;
    background-color: var(--color-primary);
    color: #ffffff !important;
}

.gradient-primary-hover:hover {
    background: var(--gradient-primary-hover) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* ── Cards ── */
.ds-card,
.monday-card,
.vendor-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.ds-card:hover,
.monday-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.ds-card-static {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-card);
}

.ds-card-interactive:hover,
.vendor-card-interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

/* Stat cards */
.stat-card,
.ds-stat-card {
    background: var(--gradient-stat);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    color: #ffffff;
    box-shadow: var(--shadow-lg);
}

.vendor-stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 1.25rem 1.5rem;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.vendor-stat-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}

/* ── Buttons ── */
.btn-primary,
.ds-btn-primary,
.vendor-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--btn-height);
    padding: 0.625rem 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: #ffffff !important;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.ds-btn-primary:hover,
.vendor-btn-primary:hover {
    background: var(--gradient-primary-hover);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-xl);
}

.btn-primary:focus-visible,
.ds-btn-primary:focus-visible,
.vendor-btn-primary:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring), var(--shadow-md);
}

.btn-secondary,
.ds-btn-secondary,
.vendor-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--btn-height);
    padding: 0.625rem 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: #374151 !important;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover,
.ds-btn-secondary:hover,
.vendor-btn-secondary:hover {
    background: #F9FAFB;
    border-color: var(--color-primary);
    color: var(--color-primary) !important;
    box-shadow: var(--shadow-md);
}

.ds-btn-danger,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--btn-height);
    padding: 0.625rem 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: #ffffff !important;
    background: var(--color-danger);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.ds-btn-danger:hover,
.btn-danger:hover {
    background: var(--color-danger-dark);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 41, 101, 0.3);
}

.ds-btn-success,
.btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--btn-height);
    padding: 0.625rem 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: #ffffff !important;
    background: var(--color-success);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.ds-btn-success:hover,
.btn-success:hover {
    background: var(--color-success-dark);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 200, 117, 0.3);
}

.ds-btn-sm,
.btn-sm {
    min-height: var(--btn-height-sm);
    padding: 0.5rem 1rem;
    font-size: var(--font-size-xs);
}

.ds-btn-lg,
.btn-lg {
    min-height: var(--btn-height-lg);
    padding: 0.75rem 2rem;
    font-size: var(--font-size-base);
}

/* White background button text fix */
button.bg-white,
a.bg-white,
.bg-white button,
.bg-white a.btn {
    color: var(--color-text-primary) !important;
}

.bg-white button.btn-primary,
.bg-white button.ds-btn-primary,
.bg-white button.bg-green-500,
.bg-white button.bg-red-500,
.bg-white button.ds-btn-danger,
.bg-white button.ds-btn-success {
    color: #ffffff !important;
}

.border.bg-white,
button.border.bg-white,
a.border.bg-white {
    color: var(--color-text-primary) !important;
    background: var(--color-surface) !important;
}

/* ── Forms ── */
.ds-input,
.vendor-input,
input.ds-input,
select.ds-input,
textarea.ds-input {
    width: 100%;
    min-height: var(--input-height);
    padding: 0.625rem 0.875rem;
    font-size: var(--font-size-sm);
    color: var(--color-dark);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea.ds-input,
textarea.vendor-input {
    min-height: 6rem;
    resize: vertical;
}

.ds-input:focus,
.vendor-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

.ds-input::placeholder,
.vendor-input::placeholder {
    color: var(--color-text-muted);
}

.ds-input-error {
    border-color: var(--color-danger) !important;
    box-shadow: 0 0 0 3px rgba(230, 41, 101, 0.12) !important;
}

.ds-helper,
.vendor-helper {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: 0.375rem;
}

.ds-error-msg {
    font-size: var(--font-size-xs);
    color: var(--color-danger);
    margin-top: 0.375rem;
}

.ds-required::after {
    content: ' *';
    color: var(--color-danger);
}

.vendor-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

/* ── Tables ── */
.ds-table,
.monday-table {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-width: 640px;
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
}

.ds-table th,
.monday-table th {
    background: var(--color-bg-subtle);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--color-dark);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.ds-table td,
.monday-table td {
    padding: 1rem;
    border-top: 1px solid var(--color-border-light);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
}

.ds-table tbody tr,
.monday-table tbody tr {
    transition: background var(--transition-fast);
}

.ds-table tbody tr:hover,
.monday-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.03);
}

/* ── Badges ── */
.badge,
.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.badge-success,
.ds-badge-success {
    background: var(--color-success-bg);
    color: var(--color-success-dark);
    border: 1px solid var(--color-success-border);
}

.badge-warning,
.ds-badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-dark);
    border: 1px solid var(--color-warning-border);
}

.badge-danger,
.ds-badge-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-dark);
    border: 1px solid var(--color-danger-border);
}

.badge-info,
.ds-badge-info {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.badge-primary,
.ds-badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-primary);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.badge-neutral,
.ds-badge-neutral {
    background: #F3F4F6;
    color: #4B5563;
    border: 1px solid #E5E7EB;
}

/* Vendor status badges (aliases) */
.vendor-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    letter-spacing: 0.01em;
}

.vendor-status-approved { color: var(--color-success-dark); background: var(--color-success-bg); border: 1px solid var(--color-success-border); }
.vendor-status-pending { color: var(--color-warning-dark); background: var(--color-warning-bg); border: 1px solid var(--color-warning-border); }
.vendor-status-rejected { color: var(--color-danger-dark); background: var(--color-danger-bg); border: 1px solid var(--color-danger-border); }
.vendor-status-suspended { color: #6B21A8; background: #FAF5FF; border: 1px solid #E9D5FF; }

/* ── Alerts ── */
.ds-alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.ds-alert-success {
    background: var(--color-success-bg);
    border-left: 4px solid var(--color-success);
    color: var(--color-success-dark);
}

.ds-alert-error {
    background: var(--color-danger-bg);
    border-left: 4px solid var(--color-danger);
    color: var(--color-danger-dark);
}

.ds-alert-warning {
    background: var(--color-warning-bg);
    border-left: 4px solid var(--color-warning);
    color: var(--color-warning-dark);
}

.ds-alert-info {
    background: var(--color-info-bg);
    border-left: 4px solid var(--color-info);
    color: var(--color-primary-dark);
}

/* ── Sidebar ── */
.sidebar-item {
    display: flex;
    align-items: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidebar-item:hover {
    background: rgba(37, 99, 235, 0.06);
    border-left-color: var(--color-primary);
    color: var(--color-primary);
}

.sidebar-item.active {
    background: rgba(37, 99, 235, 0.1);
    border-left-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}

/* ── Page header ── */
.ds-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ds-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.ds-breadcrumb a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.ds-breadcrumb a:hover {
    color: var(--color-primary);
}

/* ── Modals & dropdowns ── */
.ds-dropdown {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xl);
}

.ds-modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

/* ── Animations ── */
.card-hover {
    transition: all var(--transition-slow);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

.fade-in {
    animation: dsFadeIn 0.6s ease-in;
}

@keyframes dsFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.header-shadow {
    box-shadow: var(--shadow-sm);
}

/* ── Responsive tables ── */
@media (max-width: 768px) {
    .ds-table,
    .monday-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        min-width: 100%;
    }

    .ds-table thead,
    .monday-table thead {
        display: none;
    }

    .ds-table tbody,
    .monday-table tbody,
    .ds-table tr,
    .monday-table tr,
    .ds-table td,
    .monday-table td,
    .ds-table th,
    .monday-table th {
        display: block;
    }

    .ds-table tr,
    .monday-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--color-border-light);
        border-radius: var(--radius-md);
        padding: 1rem;
        background: var(--color-surface);
    }

    .ds-table td,
    .monday-table td {
        border: none;
        padding: 0.5rem 0;
        text-align: right;
        position: relative;
        padding-left: 50%;
    }

    .ds-table td:before,
    .monday-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        text-align: left;
    }
}

@media (max-width: 1024px) {
    #sidebar {
        box-shadow: var(--shadow-md);
    }
}
