/* ========================================
   DeepQuant Modern Theme
   Version: 2.0
   Modern, Professional, Clean Design
   ======================================== */

/* ========== CSS Variables (Design Tokens) ========== */
:root {
    /* tum_cpt_1 flat palette — solid fills, no gradients (ponytail: flatten request) */
    --primary-gradient: #3374be;
    --secondary-gradient: #3374be;
    --success-gradient: #06b6d4;
    --warning-gradient: #facc15;
    --primary-color: #ffe104;

    /* Bright Blue Backgrounds */
    --bg-primary: #022f79;
    --bg-secondary: #0754ab;
    --bg-tertiary: #3374be;
    --bg-card: #0754ab;
    --bg-card-hover: #3374be;

    /* Bright Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #f1f5f9;   /* brighter for higher contrast on navy */
    --text-muted: #cbd5e1;       /* was #bae6fd (too dim) */
    --text-accent: #ffe104;

    /* Semantic status colors — referenced ~30x across pages (buy/sell pills, badges)
       but were never defined here, so they silently resolved to nothing (no background). */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #facc15;

    /* UI Colors */
    --border-color: #3374be;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-xl: none;

    /* Flat "glass" tokens — solid, no blur (kept as vars since ~70 rules reference them) */
    --glass-bg: #0754ab;
    --glass-hover: #3374be;
    --glass-border: #3374be;
    --glass-backdrop: none;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-sans: Arial, Helvetica, sans-serif;
    --font-mono: 'Courier New', monospace;
}

/* ========== Global Styles ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 17px;  /* base bump: scales all rem-based text ~6% larger */
}

/* Responsive type scale — every rem-based font-size in the app (315+ declarations)
   anchors to this root, so these two breakpoints alone make all of them scale.
   Breakpoints match the codebase's existing convention (768px/480px are the
   dominant values used across the other @media rules in this file/folder). */
@media (max-width: 768px) {
    html { font-size: 15.5px; }
}
@media (max-width: 480px) {
    html { font-size: 14px; }
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ========== Typography ========== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--text-primary);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.875rem);
}

p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

/* ========== Modern Card Component ========== */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ========== Button Styles ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width var(--transition-base), height var(--transition-base);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-accent);
}

.btn-success {
    background: var(--success-gradient);
    color: white;
}

.btn-warning {
    background: var(--warning-gradient);
    color: white;
}

/* ========== Input Styles ========== */
.input-group {
    margin-bottom: var(--space-lg);
}

.input-label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.input, select, textarea {
    width: 100%;
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-base);
    outline: none;
}

.input:focus, select:focus, textarea:focus {
    border-color: var(--text-accent);
    background: var(--bg-card-hover);
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ========== Table Styles ========== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: var(--space-lg);
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

thead {
    background: var(--bg-tertiary);
}

th {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-weight: 600;
    color: var(--text-accent);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;  /* larger for readability (safe on any bg) */
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

/* ========== Badge/Chip Styles ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.badge-success {
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.2);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.2);
}

.badge-danger {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.2);
}

.badge-info {
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.2);
}

/* ========== Grid System ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

.grid {
    display: grid;
    gap: var(--space-xl);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-cols-4,
    .grid-cols-3,
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* ========== Flex Utilities ========== */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* ========== Spacing Utilities ========== */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.p-2xl { padding: var(--space-2xl); }

/* ========== Animation Utilities ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

.animate-slide-in {
    animation: slideIn var(--transition-base) ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ========== Loading States ========== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0%,
        var(--bg-tertiary) 50%,
        var(--bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Spinner — shared reusable loading indicator. Use <span class="spinner"></span>
   for a standalone 40px spinner, or add .spinner-sm for a 16px inline variant
   (e.g. next to "Loading…" text). */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Status Indicators ========== */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: var(--space-sm);
}

.status-active {
    background: #4ade80;
}

.status-inactive {
    background: #94a3b8;
}

.status-error {
    background: #f87171;
}

.status-warning {
    background: #fbbf24;
}

/* ========== Responsive Utilities ========== */
@media (max-width: 640px) {
    :root {
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
    }

    .card {
        padding: var(--space-lg);
    }

    h1 {
        font-size: 2rem;
    }
}

/* ========== Print Styles ========== */
@media print {
    body {
        background: white;
        color: black;
    }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}
