/* RedSketch SCTS Design System */
/* TRUE Mobile-First Design - Inspired by Claude AI Interface */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    /* Primary Colors */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    
    /* Sidebar Colors (Claude Dark Theme) */
    --sidebar-bg: #171717;
    --sidebar-hover: #262626;
    --sidebar-active: #2a2a2a;
    --sidebar-border: #2e2e2e;
    --sidebar-text: #ececec;
    --sidebar-text-muted: #8e8e8e;
    --sidebar-accent: #3b82f6;
    
    /* Gray Scale */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Semantic Colors */
    --success-50: #ecfdf5;
    --success-500: #10b981;
    --success-700: #047857;
    
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-700: #b45309;
    
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-700: #b91c1c;
    
    --info-50: #eff6ff;
    --info-500: #3b82f6;
    --info-700: #1d4ed8;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Layout */
    --sidebar-width: 260px;
    --mobile-header-height: 60px;
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--gray-900);
    background-color: var(--gray-50);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   LAYOUT CONTAINER
   ======================================== */
.layout-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ========================================
   MOBILE HEADER (Default - Visible on Mobile)
   ======================================== */
.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-header-height);
    background: var(--sidebar-bg);
    padding: 0 var(--space-4);
    z-index: 1001;
    box-shadow: var(--shadow-md);
}

.mobile-header-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: white;
    font-weight: 600;
    font-size: var(--text-base);
}

.mobile-header-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: var(--text-sm);
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.mobile-menu-toggle:hover {
    background: var(--sidebar-hover);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   SIDEBAR - MOBILE FIRST (Hidden by Default)
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1002;
    overflow-y: auto;
    overflow-x: hidden;
    
    /* MOBILE: Hidden off-screen by default */
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform var(--transition-slow), visibility var(--transition-slow);
}

/* Sidebar Open State (Mobile) */
.sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.sidebar-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: white;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: var(--text-sm);
}

.sidebar-logo-text {
    font-size: var(--text-lg);
    font-weight: 600;
}

/* Sidebar Close Button (Mobile) */
.sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-close:hover {
    background: var(--sidebar-hover);
    color: white;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: var(--space-3) 0;
    list-style: none;
}

.sidebar-nav-item {
    list-style: none;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--sidebar-text-muted);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition-fast);
}

.sidebar-nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.sidebar-nav-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text);
    border-left-color: var(--sidebar-accent);
}

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

/* Sidebar Footer */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-4);
    border-top: 1px solid var(--sidebar-border);
    background: var(--sidebar-bg);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--text-xs);
    color: var(--sidebar-text-muted);
}

.sidebar-logout-btn {
    display: block;
    width: 100%;
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.sidebar-logout-btn:hover {
    background: var(--sidebar-active);
}

/* ========================================
   MAIN CONTENT - MOBILE FIRST
   ======================================== */
.main-content {
    flex: 1;
    width: 100%;
    min-height: 100vh;
    padding: var(--space-4);
    padding-top: calc(var(--mobile-header-height) + var(--space-4));
    background: var(--gray-50);
}

/* Page Header */
.page-header {
    margin-bottom: var(--space-6);
}

.page-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-1);
}

.page-subtitle {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

/* ========================================
   STATS GRID - MOBILE FIRST (1 Column)
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

/* Stat Card */
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--gray-900);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: var(--info-50);
    color: var(--info-500);
}

.stat-icon.green {
    background: var(--success-50);
    color: var(--success-500);
}

.stat-icon.yellow {
    background: var(--warning-50);
    color: var(--warning-500);
}

.stat-icon.purple {
    background: #f3e8ff;
    color: #9333ea;
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    overflow: hidden;
    margin-bottom: var(--space-4);
}

.card-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--gray-100);
}

.card-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.card-body {
    padding: var(--space-4);
}

/* ========================================
   TABLES - MOBILE FIRST (Responsive)
   ======================================== */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.table th {
    background: var(--gray-50);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.table td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
}

.table tr:hover {
    background: var(--gray-50);
}

/* ========================================
   STATUS BADGES
   ======================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.success {
    background: var(--success-50);
    color: var(--success-700);
}

.status-badge.warning {
    background: var(--warning-50);
    color: var(--warning-700);
}

.status-badge.danger {
    background: var(--danger-50);
    color: var(--danger-700);
}

.status-badge.info {
    background: var(--info-50);
    color: var(--info-700);
}

/* Badge (for notifications) */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    min-width: 1.25rem;
    margin-left: auto;
}

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

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

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

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    position: relative;
}

/* ========================================
   PROGRESS BARS
   ======================================== */
.progress-container {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-text {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-600);
    min-width: 35px;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-600);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-outline {
    background: transparent;
    color: var(--primary-500);
    border: 1px solid var(--primary-500);
}

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

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: white;
    color: var(--gray-900);
    transition: all var(--transition-fast);
}

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

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    margin-bottom: var(--space-4);
}

.alert-success {
    background: var(--success-50);
    border-color: var(--success-500);
    color: var(--success-700);
}

.alert-warning {
    background: var(--warning-50);
    border-color: var(--warning-500);
    color: var(--warning-700);
}

.alert-danger {
    background: var(--danger-50);
    border-color: var(--danger-500);
    color: var(--danger-700);
}

.alert-info {
    background: var(--info-50);
    border-color: var(--info-500);
    color: var(--info-700);
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    text-align: center;
    padding: var(--space-8);
    color: var(--gray-400);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: var(--space-2);
}

.empty-state-text {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

/* ========================================
   UTILITIES
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success-500); }
.text-warning { color: var(--warning-500); }
.text-danger { color: var(--danger-500); }

/* ========================================
   RESPONSIVE BREAKPOINTS
   Mobile First: min-width queries only
   ======================================== */

/* Tablet (768px and up) */
@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .page-title {
        font-size: var(--text-2xl);
    }
    
    .main-content {
        padding: var(--space-6);
        padding-top: calc(var(--mobile-header-height) + var(--space-6));
    }
    
    .card-header,
    .card-body {
        padding: var(--space-5);
    }
}

/* Desktop (1024px and up) */
@media (min-width: 1024px) {
    /* Hide mobile header on desktop */
    .mobile-header {
        display: none;
    }
    
    /* Show sidebar on desktop */
    .sidebar {
        transform: translateX(0);
        visibility: visible;
    }
    
    /* Hide close button on desktop */
    .sidebar-close {
        display: none;
    }
    
    /* Adjust main content for sidebar */
    .main-content {
        margin-left: var(--sidebar-width);
        padding: var(--space-8);
        padding-top: var(--space-8);
    }
    
    /* 4 column stats on desktop */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .page-title {
        font-size: var(--text-3xl);
    }
    
    .card-header,
    .card-body {
        padding: var(--space-6);
    }
}

/* Large Desktop (1280px and up) */
@media (min-width: 1280px) {
    .main-content {
        max-width: calc(1400px + var(--sidebar-width));
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Apply animations */
.card {
    animation: fadeInUp 0.3s ease;
}

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

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .sidebar,
    .mobile-header,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}
