/* ============================================================
   BASE.CSS - Variables, Reset, and Global Utilities
   ============================================================ */

   
/* CSS Variables */
:root {
    /* ============================================================
       BRAND COLORS (constant across themes)
       ============================================================ */
    --purple-primary: hsl(258, 90%, 66%);
    --orange-primary: hsl(27, 94%, 54%);
    --pink-primary: hsl(330, 85%, 70%);
    --yellow-accent: hsl(45, 100%, 51%);

    /* ============================================================
       LIGHT MODE (default)
       ============================================================ */

    /* Backgrounds */
    --bg-primary: hsl(0, 0%, 100%);          /* Pure white for main content */
    --bg-secondary: hsl(210, 40%, 98%);      /* Very light blue-grey for alternating sections */
    --bg-card: hsl(0, 0%, 100%);             /* Pure white for cards */
    --bg-dark: hsl(210, 30%, 96%);           /* Light grey for contrast areas */

    /* Text Colors */
    --text-primary: hsl(0, 0%, 10%);         /* Almost black for text */
    --text-secondary: hsl(215, 16%, 40%);    /* Darker grey for better readability */
    --text-muted: hsl(215, 16%, 55%);        /* Medium grey for muted text */

    /* Border Colors */
    --border-color: hsl(214, 20%, 88%);      /* Light grey borders */
    --border-subtle: hsl(214, 20%, 93%);     /* Very subtle borders */

    /* Purple Variations (with opacity) */
    --purple-bg-subtle: hsla(258, 90%, 66%, 0.03);
    --purple-bg-light: hsla(258, 90%, 66%, 0.1);
    --purple-bg-medium: hsla(258, 90%, 66%, 0.15);
    --purple-border-light: hsla(258, 90%, 66%, 0.2);
    --purple-border: hsla(258, 90%, 66%, 0.3);
    --purple-border-strong: hsla(258, 90%, 66%, 0.5);
    --purple-shadow: hsla(258, 90%, 66%, 0.15);
    --purple-shadow-strong: hsla(258, 90%, 66%, 0.4);
    --purple-hover: hsl(258, 90%, 76%);

    /* Orange Variations */
    --orange-bg-light: hsla(27, 94%, 54%, 0.1);
    --orange-border: hsla(27, 94%, 54%, 0.3);
    --orange-hover: hsl(27, 94%, 64%);

    /* Semantic Colors */
    --color-success: hsl(120, 60%, 40%);
    --color-success-bg: hsl(120, 60%, 95%);
    --color-success-border: hsl(120, 60%, 70%);
    --color-error: hsl(0, 70%, 50%);
    --color-error-bg: hsl(0, 70%, 95%);
    --color-error-border: hsl(0, 70%, 70%);
    --color-warning: hsl(45, 100%, 45%);
    --color-warning-bg: hsl(45, 100%, 95%);
    --color-warning-border: hsl(45, 100%, 70%);
    --color-info: var(--purple-primary);
    --color-info-bg: var(--purple-bg-light);
    --color-info-border: var(--purple-border-light);

    /* Status Colors */
    --status-draft-bg: hsl(0, 0%, 85%);
    --status-active-bg: hsl(120, 60%, 40%);
    --status-running-bg: var(--yellow-accent);
}

/* ============================================================
   DARK MODE
   ============================================================ */
.dark-mode {
    /* Backgrounds */
    --bg-primary: hsl(240, 20%, 8%);
    --bg-secondary: hsl(240, 15%, 12%);
    --bg-card: hsl(240, 15%, 15%);
    --bg-dark: hsl(240, 20%, 10%);

    /* Text Colors */
    --text-primary: hsl(0, 0%, 95%);
    --text-secondary: hsl(0, 0%, 70%);
    --text-muted: hsl(0, 0%, 60%);

    /* Border Colors */
    --border-color: hsla(258, 90%, 66%, 0.2);
    --border-subtle: hsla(258, 90%, 66%, 0.1);

    /* Purple Variations (keep similar for consistency) */
    --purple-bg-subtle: hsla(258, 90%, 66%, 0.05);
    --purple-bg-light: hsla(258, 90%, 66%, 0.1);
    --purple-bg-medium: hsla(258, 90%, 66%, 0.15);
    --purple-border-light: hsla(258, 90%, 66%, 0.2);
    --purple-border: hsla(258, 90%, 66%, 0.3);
    --purple-border-strong: hsla(258, 90%, 66%, 0.5);
    --purple-shadow: hsla(258, 90%, 66%, 0.2);
    --purple-shadow-strong: hsla(258, 90%, 66%, 0.4);
    --purple-hover: hsl(258, 90%, 76%);

    /* Orange Variations */
    --orange-bg-light: hsla(27, 94%, 54%, 0.1);
    --orange-border: hsla(27, 94%, 54%, 0.3);
    --orange-hover: hsl(27, 94%, 64%);

    /* Semantic Colors (brighter for dark mode) */
    --color-success: hsl(120, 60%, 50%);
    --color-success-bg: hsl(120, 60%, 15%);
    --color-success-border: hsl(120, 60%, 30%);
    --color-error: hsl(0, 70%, 60%);
    --color-error-bg: hsl(0, 70%, 15%);
    --color-error-border: hsl(0, 70%, 30%);
    --color-warning: hsl(45, 100%, 51%);
    --color-warning-bg: hsl(45, 100%, 15%);
    --color-warning-border: hsl(45, 100%, 30%);

    /* Status Colors */
    --status-draft-bg: hsl(0, 0%, 30%);
    --status-active-bg: hsl(120, 60%, 40%);
    --status-running-bg: var(--yellow-accent);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Vue.js v-cloak - Hide elements until Vue is ready */
[v-cloak] {
    display: none !important;
}

/* Custom Scrollbars - Fulgur AI Style */
/* For Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--purple-primary), var(--orange-primary));
    border-radius: 4px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--purple-hover), var(--orange-hover));
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--purple-primary) var(--bg-dark);
}

/* Global Styles */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Focus styles for accessibility */
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--purple-primary);
    outline-offset: 2px;
}

/* Common Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--purple-primary), var(--orange-primary));
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    font-family: inherit;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 1rem 2rem;
    border: 2px solid var(--purple-primary);
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--purple-primary);
    transform: translateY(-2px);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-small {
    padding: 0.5rem 1rem;
    background: var(--purple-border-light);
    color: var(--purple-primary);
    border: 1px solid var(--purple-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    font-family: inherit;
}

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

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

/* Display */
.hide {
    display: none !important;
}

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* Gap */
.gap-05 { gap: 0.5rem; }
.gap-075 { gap: 0.75rem; }
.gap-1 { gap: 1rem; }
.gap-15 { gap: 1.5rem; }
.gap-2 { gap: 2rem; }

/* Width */
.w-full { width: 100%; }
.w-250 { width: 250px; }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Font Size */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.85rem; }
.text-base { font-size: 0.875rem; }
.text-md { font-size: 0.9rem; }
.text-lg { font-size: 1rem; }

/* Font Family */
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-sans { font-family: 'Inter', sans-serif; }

/* Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-orange { color: var(--orange-primary); }
.text-purple { color: var(--purple-primary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }

/* Margins */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-05 { margin-top: 0.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-2px { margin-top: 2px; }

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

.mr-05 { margin-right: 0.5rem; }
.mr-1 { margin-right: 0.5rem; }
.mr-6px { margin-right: 6px; }

.ml-05 { margin-left: 0.5rem; }
.ml-1 { margin-left: 0.5rem; }

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.pt-2 { padding-top: 1rem; }
.pt-3 { padding-top: 1.5rem; }

.pb-0 { padding-bottom: 0; }
.pb-2 { padding-bottom: 1rem; }
.pb-3 { padding-bottom: 1.5rem; }

/* Links */
.link-reset {
    color: var(--text-secondary);
    text-decoration: none;
}

.link-purple {
    color: var(--purple-primary);
    text-decoration: underline;
}

.link-orange {
    color: var(--orange-primary);
    text-decoration: none;
}

/* Loading spinner */
.spinner {
    border: 3px solid var(--purple-border);
    border-top: 3px solid var(--purple-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Code blocks */
pre {
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--purple-bg-light);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

/* ============================================================
   THEME TOGGLE SWITCH
   ============================================================ */

.theme-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    transition: all 0.3s;
    border-radius: 28px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: linear-gradient(135deg, var(--purple-primary), var(--orange-primary));
    transition: all 0.3s;
    border-radius: 50%;
}

.theme-switch input:checked + .theme-slider {
    background: var(--purple-bg-light);
    border-color: var(--purple-primary);
}

.theme-switch input:checked + .theme-slider:before {
    transform: translateX(24px);
}

.theme-switch input:focus + .theme-slider {
    box-shadow: 0 0 0 3px var(--purple-bg-light);
}

/* Print styles */
@media print {
    header, footer, .btn-signin, .cta-buttons {
        display: none;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .btn-primary, .btn-secondary {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .hide-mobile {
        display: none !important;
    }
}
