/* VETRIOS Admin Panel v3.0 - Refined Design inspired by VITO */
:root {
    /* VETRIOS Core Colors */
    --vetrios-teal: #0D9488;
    --vetrios-teal-light: #14B8A6;
    --vetrios-teal-dark: #0F766E;
    --vetrios-orange: #EA580C;
    --vetrios-blue: #0EA5E9;
    
    /* Refined Dark Theme - Softer, Less Harsh */
    --bg-primary: #0F1419;          /* Darker, warmer slate */
    --bg-secondary: #1C2128;        /* Softer secondary */
    --bg-tertiary: #262C36;         /* Subtle tertiary */
    --bg-card: #1A1F26;             /* Card background */
    --bg-card-hover: #252B34;       /* Hover state */
    --bg-accent: #2D3748;           /* Accent backgrounds */
    
    /* Text Colors - Better Hierarchy */
    --text-primary: #F7FAFC;        /* Pure white for headings */
    --text-secondary: #E2E8F0;      /* Secondary text */
    --text-tertiary: #A0AEC0;       /* Muted text */
    --text-muted: #718096;          /* Very muted */
    --text-brand: #4299E1;          /* Brand text */
    
    /* Accent System */
    --accent-primary: var(--vetrios-teal);
    --accent-secondary: var(--vetrios-teal-light);
    --accent-gradient: linear-gradient(135deg, var(--vetrios-teal) 0%, var(--vetrios-teal-light) 100%);
    --accent-glow: 0 0 20px rgba(13, 148, 136, 0.15);
    
    /* Status Colors - More Subtle */
    --success: #48BB78;
    --success-bg: rgba(72, 187, 120, 0.1);
    --warning: #ED8936;
    --warning-bg: rgba(237, 137, 54, 0.1);
    --error: #F56565;
    --error-bg: rgba(245, 101, 101, 0.1);
    --info: var(--vetrios-blue);
    --info-bg: rgba(14, 165, 233, 0.1);
    
    /* Border System - Subtle */
    --border-light: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.16);
    --border-accent: var(--accent-primary);
    
    /* Typography - Refined */
    --font-headline: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
    
    /* Shadows - Layered */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2), 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 0 1px rgba(13, 148, 136, 0.2), 0 4px 16px rgba(13, 148, 136, 0.15);
    
    /* Motion */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Spacing Scale */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 0.75rem;   /* 12px */
    --space-lg: 1rem;      /* 16px */
    --space-xl: 1.5rem;    /* 24px */
    --space-2xl: 2rem;     /* 32px */
    --space-3xl: 3rem;     /* 48px */
    
    /* Border Radius Scale */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-full: 9999px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout Container - Improved */
.admin-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* Sidebar - Refined */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 260px;
    overflow-y: auto;
    z-index: 1000;
    backdrop-filter: blur(20px);
}

.sidebar-header {
    padding: var(--space-2xl) var(--space-xl);
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    position: relative;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--accent-gradient);
}

.sidebar-header h2 {
    font-family: var(--font-headline);
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.015em;
}

.sidebar-header h2 span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header p {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.sidebar-nav {
    padding: var(--space-xl) var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-tertiary);
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-radius: var(--radius-lg);
    position: relative;
    font-family: var(--font-body);
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    transform: translateX(2px);
}

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
    font-weight: 600;
    box-shadow: var(--shadow-glow);
    transform: translateX(2px);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--vetrios-orange);
    border-radius: var(--radius-full);
}

.nav-item .icon {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    opacity: 0.8;
}

.nav-item.active .icon {
    opacity: 1;
}

/* Main Content Area - Refined */
.admin-main {
    margin-left: 260px;
    background: var(--bg-primary);
    min-height: 100vh;
    position: relative;
}

.admin-header {
    background: var(--bg-secondary);
    padding: var(--space-xl) var(--space-2xl);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.btn-icon {
    background: var(--bg-accent);
    border: 1px solid var(--border-medium);
    color: var(--text-tertiary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.admin-content {
    padding: var(--space-2xl);
    min-height: calc(100vh - 80px);
}

.section {
    display: none;
    animation: slideInUp var(--transition-slow) ease-out;
}

.section.active {
    display: block;
}

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

/* Dashboard Stats - VITO-Style */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--bg-card);
    padding: var(--space-xl);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

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

.stat-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-lg);
    opacity: 0.7;
    display: block;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-sm);
    line-height: 1;
    font-family: var(--font-headline);
}

.stat-label {
    color: var(--text-tertiary);
    font-weight: 500;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Content Cards - Refined */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: var(--space-xl);
}

.card {
    background: var(--bg-card);
    padding: var(--space-2xl);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
}

.card h3 {
    margin-bottom: var(--space-xl);
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    font-family: var(--font-headline);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.card h3::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Activity Lists - Refined */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.activity-item {
    padding: var(--space-lg);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.activity-item:hover {
    border-left-color: var(--accent-secondary);
    background: var(--bg-accent);
}

.activity-item p {
    font-size: 0.875rem;
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
}

.activity-item .time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Status Lists */
.status-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.status-item {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.status-item:hover {
    background: var(--bg-accent);
    border-color: var(--border-medium);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
    transition: all var(--transition-base);
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 0 3px var(--success-bg);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.1); 
        opacity: 0.8; 
    }
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.section-header h2 {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Tables - Refined */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-light);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

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

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

.data-table th {
    padding: var(--space-lg);
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-light);
}

.data-table td {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.data-table tbody tr {
    transition: all var(--transition-fast);
}

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

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges - Refined */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

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

.badge.inactive {
    background: var(--error-bg);
    color: var(--error);
}

.badge.pending {
    background: var(--warning-bg);
    color: var(--warning);
}

/* Project Cards */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-xl);
}

.project-card {
    background: var(--bg-card);
    padding: var(--space-2xl);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

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

.project-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.project-card h3 {
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    font-family: var(--font-headline);
}

.meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    font-weight: 500;
}

.description {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin: var(--space-xl) 0;
    line-height: 1.5;
}

.card-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

/* Buttons - VITO Style */
.btn-primary {
    background: var(--accent-gradient);
    color: white;
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-body);
    letter-spacing: -0.005em;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-small {
    padding: var(--space-sm) var(--space-lg);
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.btn-small:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

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

/* Forms - Refined */
.settings-form {
    background: var(--bg-card);
    padding: var(--space-2xl);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-light);
    max-width: 600px;
}

.form-group {
    margin-bottom: var(--space-xl);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-secondary);
    transition: all var(--transition-base);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

/* Template Items */
.templates-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.template-item {
    background: var(--bg-card);
    padding: var(--space-xl);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-light);
    display: grid;
    grid-template-columns: 60px 1fr auto;
    align-items: center;
    gap: var(--space-xl);
    transition: all var(--transition-base);
}

.template-item:hover {
    border-color: var(--border-strong);
    background: var(--bg-card-hover);
    transform: translateX(4px);
}

.template-preview {
    font-size: 1.5rem;
    text-align: center;
    background: var(--accent-gradient);
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.template-info h3 {
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    font-family: var(--font-headline);
}

.template-info p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.template-actions {
    display: flex;
    gap: var(--space-md);
}

/* Loading States */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-full);
    border-top-color: var(--accent-primary);
    animation: spin 1s linear infinite;
}

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

/* Responsive Design - Enhanced */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        left: -260px;
        transition: left var(--transition-base);
    }
    
    .sidebar.open {
        left: 0;
        box-shadow: var(--shadow-xl);
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .stats-grid,
    .grid-3,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .template-item {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--space-lg);
    }
    
    .admin-header {
        padding: var(--space-lg);
    }
    
    .admin-content {
        padding: var(--space-lg);
    }
}

/* Dark Mode Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* Focus Management */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-light: rgba(255, 255, 255, 0.3);
        --border-medium: rgba(255, 255, 255, 0.5);
        --border-strong: rgba(255, 255, 255, 0.7);
    }
}