/**
 * AI-VAULT-LAB - Estilos Principales
 * Archivo: public/assets/css/app.css
 * 
 * Sistema de diseño premium con tema oscuro moderno
 */

/* ============================================
   CSS Variables (Design Tokens)
   ============================================ */
:root {
    /* Colores primarios */
    --primary: #8B5CF6;
    --primary-light: #A78BFA;
    --primary-dark: #7C3AED;
    
    /* Colores secundarios */
    --secondary: #3B82F6;
    --accent: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    
    /* Fondo tema oscuro */
    --bg-primary: #0F0F1A;
    --bg-secondary: #1A1A2E;
    --bg-card: #16162A;
    --bg-hover: #252542;
    
    /* Texto */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    /* Bordes */
    --border-color: #2D2D4A;
    --border-glow: rgba(139, 92, 246, 0.3);
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    --gradient-card: linear-gradient(180deg, rgba(139, 92, 246, 0.05) 0%, transparent 100%);
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.2);
    
    /* Espaciado */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Tipografía */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Bordes redondeados */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Transiciones */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   Layout Principal
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-lg);
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
    padding: 0 var(--space-sm);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-xs);
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.nav-link.active svg {
    opacity: 1;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.user-profile:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: var(--space-xl);
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.card-body {
    color: var(--text-secondary);
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-icon {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.2;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.8125rem;
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-error {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: var(--space-xs);
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ============================================
   Tables
   ============================================ */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
}

.table tr:hover {
    background: var(--bg-hover);
}

.table tr:last-child td {
    border-bottom: none;
}

/* ============================================
   Badges & Status
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-primary {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary-light);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34D399;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #FBBF24;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #F87171;
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    display: inline-block;
}

/* ============================================
   Tool Cards
   ============================================ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.tool-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.tool-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.tool-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.tool-info {
    flex: 1;
    min-width: 0;
}

.tool-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.tool-vendor {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.tool-summary {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.tool-score {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.875rem;
    font-weight: 600;
}

.tool-score-value {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Alerts & Messages
   ============================================ */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34D399;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #F87171;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #FBBF24;
}

/* ============================================
   Search & Filters
   ============================================ */
.search-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input-wrapper svg {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 20px;
    height: 20px;
}

.search-input {
    width: 100%;
    padding: var(--space-md) var(--space-md) var(--space-md) 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.filters-row {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.filter-select {
    min-width: 160px;
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: var(--space-lg);
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    font-size: 1.75rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.login-form .form-group:last-of-type {
    margin-bottom: var(--space-xl);
}

.login-btn {
    width: 100%;
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
}

.empty-state-icon svg {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.empty-state-text {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    margin-top: var(--space-xl);
}

.pagination-item {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.pagination-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination-item.active {
    background: var(--primary);
    color: white;
}

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-light); }
.text-success { color: #34D399; }
.text-warning { color: #FBBF24; }
.text-danger { color: #F87171; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.hidden { display: none; }

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn var(--transition-normal) ease forwards;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar-logo span,
    .nav-section-title,
    .nav-link span,
    .user-info {
        display: none;
    }
    
    .nav-link {
        justify-content: center;
        padding: var(--space-md);
    }
    
    .user-profile {
        justify-content: center;
    }
    
    .main-content {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left var(--transition-normal);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: var(--space-md);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .filters-row {
        width: 100%;
    }
}
