/* AI App Factory Dark Theme - Professional Modern UI */
/* ============================================== */

:root {
    /* Dark Theme Color Palette */
    --bg-primary: #0f0f0f;      /* Main background - deep black */
    --bg-secondary: #1a1a1a;    /* Cards/sections background - dark gray */
    --bg-tertiary: #242424;     /* Cards/panels */
    --bg-hover: #333333;        /* Hover states/borders */
    
    /* Text Colors */
    --text-primary: #f0f0f0;    /* Main text - bright white */
    --text-secondary: #b8b8b8;  /* Secondary text */
    --text-muted: #888888;      /* Muted text */
    
    /* Brand Colors */
    --accent-primary: #6366f1;  /* Indigo accent */
    --accent-secondary: #6366f1; /* Indigo accent */
    --accent-gradient: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    
    /* Status Colors */
    --success: #10b981;         /* Subtle green */
    --warning: #f59e0b;         /* Soft amber */
    --error: #ef4444;           /* Muted red */
    --info: #06b6d4;            /* Cyan */
    
    /* Borders & Shadows */
    --border-color: #333333;
    --border-light: #262626;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --glow-primary: 0 0 20px rgba(99, 102, 241, 0.3);
    --glow-secondary: 0 0 20px rgba(99, 102, 241, 0.3);
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Compatibility aliases */
    --text-dark: var(--text-primary);
    --gray-600: var(--text-muted);
    --gray-100: var(--bg-tertiary);
    --text-light: var(--text-secondary);
    --primary-blue: var(--accent-primary);
    --secondary-green: var(--success);
    --white: white;
    --radius: 0.5rem;
    --shadow: var(--shadow-md);
}

/* ============================================== */
/* Global Styles */
/* ============================================== */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* ============================================== */
/* Typography */
/* ============================================== */

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.1rem; }

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-secondary);
}

/* ============================================== */
/* Navigation Bar */
/* ============================================== */

.navbar {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    color: var(--text-primary) !important;
    font-weight: 700;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.navbar-brand:hover {
    color: var(--accent-primary) !important;
    transform: translateX(2px);
}

.navbar-nav .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    margin: 0 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all var(--transition-fast);
}

.navbar-nav .nav-link:hover {
    color: var(--accent-primary) !important;
    background: rgba(74, 158, 255, 0.1);
}

.navbar-nav .nav-link.active {
    color: var(--accent-primary) !important;
    background: rgba(74, 158, 255, 0.15);
}

/* Mobile Navigation Toggle */
.navbar-toggler {
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    padding: 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: var(--glow-primary);
}

/* ============================================== */
/* Buttons */
/* ============================================== */

.btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.btn:hover:before {
    left: 100%;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), var(--glow-primary);
    color: white;
}

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

.btn-secondary:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--accent-primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #0ea968;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(16, 185, 129, 0.3);
    color: white;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc3030;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(239, 68, 68, 0.3);
    color: white;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

/* ============================================== */
/* Cards & Panels */
/* ============================================== */

.card, .stat-card, .panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card:before, .stat-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
}

.card:hover, .stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-primary);
}

.card-header {
    background: var(--bg-tertiary);
    padding: 1rem;
    margin: -1.5rem -1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0;
}

/* ============================================== */
/* Forms */
/* ============================================== */

.form-control, .form-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
    outline: none;
}

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

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

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

/* ============================================== */
/* Tables */
/* ============================================== */

.table {
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    overflow: hidden;
}

.table thead {
    background: var(--bg-tertiary);
}

.table thead th {
    color: var(--text-primary);
    border-color: var(--border-color);
    font-weight: 600;
    padding: 1rem;
}

.table tbody td {
    color: var(--text-secondary);
    border-color: var(--border-light);
    padding: 0.75rem 1rem;
}

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

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(255, 255, 255, 0.02);
}

/* ============================================== */
/* Statistics */
/* ============================================== */

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    display: block;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

/* ============================================== */
/* Alerts */
/* ============================================== */

.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--info);
    color: var(--info);
}

/* ============================================== */
/* Badges */
/* ============================================== */

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-primary {
    background: var(--accent-primary);
    color: white;
}

.badge-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-success {
    background: var(--success);
    color: white;
}

/* ============================================== */
/* Loading States */
/* ============================================== */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* ============================================== */
/* Dashboard Specific */
/* ============================================== */

.dashboard {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.header-section {
    margin-bottom: 2rem;
}

.header-section h1 {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.action-section {
    margin-bottom: 2rem;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ============================================== */
/* Category Tags */
/* ============================================== */

.category-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0.25rem;
    transition: all var(--transition-fast);
}

.category-tag:hover {
    background: var(--accent-primary);
    color: white;
}

/* ============================================== */
/* Responsive Design */
/* ============================================== */

/* Mobile (320px - 768px) */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .dashboard {
        padding: 1rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .navbar-nav {
        padding: 1rem 0;
    }
    
    .navbar-nav .nav-link {
        margin: 0.25rem 0;
    }
    
    .table-responsive {
        overflow-x: auto;
    }
    
    .card, .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .dashboard {
        padding: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .container-fluid {
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* ============================================== */
/* Utilities */
/* ============================================== */

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent-primary) !important; }

.bg-primary { background: var(--bg-primary) !important; }
.bg-secondary { background: var(--bg-secondary) !important; }
.bg-tertiary { background: var(--bg-tertiary) !important; }

.border-primary { border-color: var(--accent-primary) !important; }
.border-secondary { border-color: var(--border-color) !important; }

.rounded { border-radius: 0.5rem !important; }
.rounded-lg { border-radius: 1rem !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl { box-shadow: var(--shadow-xl) !important; }

/* ============================================== */
/* Animations */
/* ============================================== */

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

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

.slide-in {
    animation: slideIn 0.5s ease-out;
}

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