/* ============================================================
   STACKCTL UI THEME
   ------------------------------------------------------------
   Purpose:
   - Provide clean, reusable UI primitives
   - Reduce Tailwind repetition
   - Support light/dark mode
   - NO build tools required (CDN friendly)
   ------------------------------------------------------------
   Philosophy:
   - Keep it minimal
   - Let patterns evolve before expanding
   - Do NOT recreate Tailwind
============================================================ */


/* ============================================================
   GLOBAL BASE
============================================================ */

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ============================================================
    NAVIGATION
============================================================ */
.nav-section {
    display: block;
    margin-top: 6px;
    padding-top: 0.25rem;
    border-top: 1px solid #e5e7eb;
}

.nav-section-label {
    display: block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af; /* gray-400 */
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .nav-section {
        border-top-color: #374151; /* gray-700 */
    }
}

/* ============================================================
   GRID / ROW SYSTEM (LIGHTWEIGHT)
============================================================ */

.row {
    display: grid;
    gap: 1.5rem; /* gap-6 */
    grid-template-columns: 1fr;
}

/* Auto-fit grid (responsive tiles) */
.row-auto {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Responsive columns */
@media (min-width: 768px) {
    .row-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .row-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .row-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .row-5 {
        grid-template-columns: repeat(5, 1fr);
    }

    .row-6 {
        grid-template-columns: repeat(6, 1fr);
    }
}


/* ============================================================
   BUTTONS
============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-primary {
    background: #2563eb;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-danger {
    background: #ef4444;
    color: #ffffff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Theme selector buttons */
.theme-btn {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    transition: all 0.2s ease;
    cursor: pointer;
}

.theme-btn:hover {
    background: #f3f4f6;
}

.dark .theme-btn:hover {
    background: #374151;
}

/* Active state */
.theme-btn-active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* ============================================================
   INPUTS
============================================================ */
label {
    color: #374151; /* gray-700 */
}

.dark label {
    color: #d1d5db; /* gray-300 */
}
.input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    background: #ffffff;
    transition: all 0.2s ease;
}

.dark .input {
    background: #374151;
    border-color: #4b5563;
    color: #ffffff;
}

.input:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
}

.input-error {
    border-color: #ef4444;
}

.input-error:focus {
    box-shadow: 0 0 0 2px #ef4444;
}


/* ============================================================
   LABELS
============================================================ */

.label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}


/* ============================================================
   CARDS / CONTAINERS
============================================================ */

.card {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dark .card {
    background: #1f2937;
}


/* Page container (optional wrapper for consistency) */
.container-page {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem;
}


/* ============================================================
   ALERTS / FLASH MESSAGES
============================================================ */

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.dark .alert-success {
    background: #064e3b;
    color: #a7f3d0;
}

.dark .alert-error {
    background: #7f1d1d;
    color: #fecaca;
}


/* ============================================================
   NAV / SIDEBAR HELPERS
============================================================ */

.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: background 0.2s ease;
}

.nav-link:hover {
    background: #f3f4f6;
}

.dark .nav-link:hover {
    background: #374151;
}

.nav-link-active {
    background: #e5e7eb;
    font-weight: 600;
}

.dark .nav-link-active {
    background: #4b5563;
}


/* ============================================================
   UTILITIES (LIGHTWEIGHT)
============================================================ */

/* Simple spacing helpers (optional) */
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }

/* Text helpers */
.text-muted {
    color: #6b7280;
}

.dark .text-muted {
    color: #9ca3af;
}