/* ======================================
   Sistema de Roles - SAFDI
   Professional Styles
   ====================================== */

/* ========== CSS VARIABLES ========== */
:root {
    /* Color Palette - Professional Dark Theme */
    --primary-900: #0f172a;
    --primary-800: #1e293b;
    --primary-700: #334155;
    --primary-600: #475569;
    --accent-600: #3b82f6;
    --accent-500: #60a5fa;
    --accent-400: #93c5fd;
    --success-600: #059669;
    --success-500: #10b981;
    --warning-600: #d97706;
    --warning-500: #f59e0b;
    --error-600: #dc2626;
    --error-500: #ef4444;
    --surface-900: #0a0e1a;
    --surface-800: #111827;
    --surface-700: #1f2937;
    --surface-600: #374151;
    --text-primary: #f8fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --border-light: #475569;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.04);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    
    /* Transitions */
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== RESET Y BASE ========== */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--surface-900) 0%, var(--primary-900) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.font-mono {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out;
}

.animate-pulse-subtle {
    animation: pulse 2s infinite;
}

/* ========== GLASS MORPHISM ========== */
.glass {
    background: rgba(30, 41, 59, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ========== HEADER STYLES ========== */
.header-gradient {
    background: linear-gradient(135deg, var(--primary-900) 0%, var(--surface-900) 50%, var(--primary-800) 100%);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ========== BUTTON STYLES ========== */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-600), var(--accent-500));
    border: 1px solid var(--accent-500);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    border: 1px solid var(--border-color);
}

.btn-primary:disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--success-600), var(--success-500));
    border: 1px solid var(--success-500);
    transition: var(--transition-normal);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(5, 150, 105, 0.3);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-ghost:hover {
    background: var(--surface-700);
    border-color: var(--border-light);
    color: var(--text-primary);
}

/* ========== AGENCIA BUTTONS ========== */
.agencia-btn {
    flex: 1 1 200px;
    min-width: 200px;
    max-width: 300px;
    min-height: 3rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--surface-700);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.agencia-btn:hover {
    border-color: var(--accent-500);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.agencia-btn.active {
    background: linear-gradient(135deg, var(--accent-600), var(--accent-500));
    border-color: var(--accent-500);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.agencia-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

/* Ajuste responsive para botones de agencia */
@media (max-width: 768px) {
    .agencia-btn {
        flex: 1 1 150px;
        min-width: 150px;
        font-size: 0.75rem;
        padding: 0.65rem 1rem;
    }
}

/* ========== FORM STYLES ========== */
.form-input {
    background: var(--surface-800);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.form-input:focus {
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--surface-700);
    outline: none;
}

.form-input:hover {
    border-color: var(--border-light);
}

/* ========== CARD STYLES ========== */
.card-modern {
    background: var(--surface-800);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-500), var(--success-500));
}

/* ========== PERSONAL ROW ========== */
.personal-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: var(--surface-800);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: var(--transition-normal);
}

.personal-row:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}

.personal-row .personal-name {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.personal-row select {
    flex: 0 0 auto;
    min-width: 220px;
    background: var(--surface-700);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.personal-row select:focus {
    border-color: var(--accent-500);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.personal-row.has-role {
    border-color: var(--success-500);
    background: rgba(16, 185, 129, 0.05);
}

/* ========== LOADING STYLES ========== */
.loading-spinner {
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-500);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

/* ========== SUMMARY CARDS ========== */
.summary-card {
    background: var(--surface-700);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--transition-fast);
}

.summary-card:hover {
    border-color: var(--accent-500);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.summary-card .role-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.summary-card .role-count {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-500);
}

.summary-card .role-names {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-height: 120px;
    overflow-y: auto;
}

/* ========== SCROLLBAR STYLING ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-800);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ========== UTILITY CLASSES ========== */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-500); }
.text-success { color: var(--success-500); }
.text-warning { color: var(--warning-500); }
.text-error { color: var(--error-500); }

.hidden {
    display: none !important;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-modern {
        padding: 1.5rem;
    }
    
    .header-gradient h1 {
        font-size: 1.5rem;
    }

    .personal-row {
        flex-direction: column;
        align-items: stretch;
    }

    .personal-row select {
        min-width: 100%;
    }
}

/* ========== FOCUS STYLES ========== */
*:focus {
    outline: 2px solid var(--accent-500);
    outline-offset: 2px;
}

.form-input:focus,
select:focus {
    outline: none;
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-fade-in-up,
    .animate-fade-in-left,
    .animate-pulse-subtle {
        animation: none !important;
    }
}

