/* MT5 Master Pro — Design System */

/* ================================
   DESIGN TOKENS
   ================================ */

:root {
    /* Backgrounds — Dark Theme (Default) */
    --bg-primary: #09090b;
    --bg-secondary: #111113;
    --bg-tertiary: #1a1a1e;

    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Borders */
    --border-color: #27272a;
    --border-color-light: #1e1e22;

    /* Surfaces */
    --card-bg: #141416;
    --card-border: #27272a;
    --input-bg: #1a1a1e;
    --hover-bg: #27272a;

    /* Brand */
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-accent: #60a5fa;

    /* Semantic */
    --color-success: #22c55e;
    --color-danger: #ef4444;
    --color-warning: #eab308;
    --color-info: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 2px 8px rgba(0,0,0,.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.35);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Legacy compat aliases */
    --glass-bg: var(--card-bg);
    --glass-border: var(--card-border);
    --glass-shadow: var(--shadow-md);
    --blur-amount: 0px;
    --overlay-bg: rgba(0,0,0,.5);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f4f4f5;

    --text-primary: #09090b;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;

    --border-color: #e4e4e7;
    --border-color-light: #f4f4f5;

    --card-bg: #ffffff;
    --card-border: #e4e4e7;
    --input-bg: #f4f4f5;
    --hover-bg: #e4e4e7;

    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-accent: #3b82f6;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.08);

    --glass-bg: var(--card-bg);
    --glass-border: var(--card-border);
    --glass-shadow: var(--shadow-md);
    --overlay-bg: rgba(255,255,255,.6);
}

/* ================================
   BASE STYLES
   ================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    transition: background-color .2s ease, color .2s ease;
}

/* ================================
   ANIMATIONS (simplified)
   ================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    opacity: 0;
    animation: fadeIn .5s ease forwards;
}

.fade-in-delay-1 { animation-delay: .1s; }
.fade-in-delay-2 { animation-delay: .2s; }
.fade-in-delay-3 { animation-delay: .3s; }

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}

.slide-in-left {
    opacity: 0;
    animation: slideInLeft .5s ease forwards;
    animation-delay: .15s;
}

.fade-in.animated,
.slide-in-left.animated {
    will-change: auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================
   SCROLLBAR
   ================================ */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ================================
   FORMS
   ================================ */

.form-input {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

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

/* ================================
   BUTTONS
   ================================ */

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    transition: background .15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-primary:active {
    transform: scale(.98);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    transition: background .15s ease, border-color .15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    transition: color .15s ease, background .15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    transition: background .15s ease;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ================================
   CARDS
   ================================ */

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color .2s ease;
}

.card:hover {
    border-color: var(--text-muted);
}

.card-highlight {
    border: 1px solid var(--color-primary);
}

/* ================================
   BADGES
   ================================ */

.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 9999px;
    display: inline-block;
}

.badge-primary {
    background: rgba(59,130,246,.15);
    color: var(--color-accent);
}

.badge-success {
    background: rgba(34,197,94,.15);
    color: #22c55e;
}

.badge-danger {
    background: rgba(239,68,68,.15);
    color: #ef4444;
}

.badge-warning {
    background: rgba(234,179,8,.15);
    color: #eab308;
}

.badge-gray {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ================================
   MESSAGES
   ================================ */

.message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 500;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.message-error {
    background: rgba(239,68,68,.1);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,.25);
}

.message-success {
    background: rgba(34,197,94,.1);
    color: #86efac;
    border: 1px solid rgba(34,197,94,.25);
}

.message-info {
    background: rgba(59,130,246,.1);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,.25);
}

[data-theme="light"] .message-error { color: #dc2626; }
[data-theme="light"] .message-success { color: #16a34a; }
[data-theme="light"] .message-info { color: #2563eb; }

/* ================================
   TABLES
   ================================ */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead tr {
    border-bottom: 1px solid var(--border-color);
}

.table th {
    text-align: left;
    padding: 10px 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color .1s ease;
}

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

.table td {
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* ================================
   SPINNER
   ================================ */

.spinner {
    border: 2px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin .6s linear infinite;
}

/* ================================
   UTILITIES
   ================================ */

.text-primary { color: var(--color-primary); }
.bg-primary { background-color: var(--color-primary); }
.border-primary { border-color: var(--color-primary); }
.gradient-primary { background: var(--color-primary); }

.hidden { display: none !important; }

@media (max-width: 768px) {
    .mobile-hidden { display: none; }
}

@media print {
    .no-print { display: none; }
}

*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

html {
    scroll-behavior: smooth;
}

h1, h2, h3, h4, h5, h6 { color: var(--text-primary); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ================================
   TOAST NOTIFICATION SYSTEM
   ================================ */

.toast-notification {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(120%);
    transition: all .3s ease;
    max-width: 380px;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    min-width: 280px;
}

.toast-success { border-left: 3px solid #22c55e; }
.toast-error   { border-left: 3px solid #ef4444; }
.toast-warning { border-left: 3px solid #eab308; }
.toast-info    { border-left: 3px solid #3b82f6; }

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-success .toast-icon { color: #22c55e; }
.toast-error .toast-icon   { color: #ef4444; }
.toast-warning .toast-icon { color: #eab308; }
.toast-info .toast-icon    { color: #3b82f6; }

.toast-text {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toast-close {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background .15s ease;
    color: var(--text-muted);
    flex-shrink: 0;
}

.toast-close svg { width: 16px; height: 16px; }
.toast-close:hover { background: var(--hover-bg); color: var(--text-primary); }

.toast-notification:nth-child(2) { top: 150px; }
.toast-notification:nth-child(3) { top: 220px; }

@media (max-width: 640px) {
    .toast-notification { right: 8px; left: 8px; max-width: none; }
    .toast-content { min-width: auto; }
}
