/* ========================================
   REUSABLE COMPONENT CLASSES
   Based on the modern style from landing page
   and patterns from prototipos-frontend
   ======================================== */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    /* Primary Colors (Purple/Violet) */
    --color-primary-50: #f5f3ff;
    --color-primary-100: #ede9fe;
    --color-primary-200: #ddd6fe;
    --color-primary-300: #c4b5fd;
    --color-primary-400: #a78bfa;
    --color-primary-500: #8b5cf6;
    --color-primary-600: #7c3aed;
    --color-primary-700: #6d28d9;
    --color-primary-800: #5b21b6;
    --color-primary-900: #4c1d95;

    /* Gray Scale */
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;

    /* Semantic Colors */
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-success-dark: #065f46;

    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-warning-dark: #92400e;

    --color-error: #ef4444;
    --color-error-light: #fee2e2;
    --color-error-dark: #991b1b;

    --color-info: #3b82f6;
    --color-info-light: #dbeafe;
    --color-info-dark: #1e40af;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15), 0 10px 10px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* ========================================
   1. CARDS
   ======================================== */

.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(229, 231, 235, 0.8);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.card-glass:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.card-metric {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem 2rem;
    border-left: 4px solid var(--color-primary-500);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card-metric:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-item {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.card-item:hover {
    background: linear-gradient(90deg, var(--color-primary-50) 0%, rgba(250, 245, 255, 0.5) 100%);
    padding-left: 1.25rem;
}

/* Section Cards */
.section-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s ease;
}

.section-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.15);
}

/* Metric Cards */
.metric-card {
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.15);
}

/* ========================================
   2. BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-400) 100%);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.5);
}

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

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

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

.btn-ghost {
    background: transparent;
    color: var(--color-primary-600);
    border: none;
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.1);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
}

/* Button Sizes */
.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* ========================================
   3. BADGES
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1rem;
    white-space: nowrap;
}

.badge-primary {
    background: var(--color-primary-100);
    color: var(--color-primary-700);
}

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

.badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning-dark);
}

.badge-error {
    background: var(--color-error-light);
    color: var(--color-error-dark);
}

.badge-info {
    background: var(--color-info-light);
    color: var(--color-info-dark);
}

.badge-gray {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
}

/* ========================================
   4. TABLES
   ======================================== */

.table-header {
    background: var(--color-gray-50);
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-gray-500);
}

.table-row {
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    padding: 1rem;
    transition: background-color 0.2s ease;
}

.table-row:hover {
    background: linear-gradient(90deg, var(--color-primary-50) 0%, rgba(250, 245, 255, 0.5) 100%);
}

.table-row:last-child {
    border-bottom: none;
}

.table-row-hover {
    transition: all 0.2s ease;
}

.table-row-hover:hover {
    background: linear-gradient(90deg, var(--color-primary-50) 0%, rgba(250, 245, 255, 0.5) 100%);
    transform: translateX(4px);
}

/* ========================================
   5. FORM ELEMENTS
   ======================================== */

.input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border: 1px solid var(--color-gray-300);
    border-radius: 0.5rem;
    background: white;
    color: var(--color-gray-900);
    transition: all 0.2s ease;
    outline: none;
}

.input:focus {
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.input-error {
    border-color: var(--color-error);
}

.input-error:focus {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.select {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border: 1px solid var(--color-gray-300);
    border-radius: 0.5rem;
    background: white url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") no-repeat right 0.5rem center/1.5em 1.5em;
    color: var(--color-gray-900);
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
    cursor: pointer;
}

.select:focus {
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-700);
    margin-bottom: 0.5rem;
}

.textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.5rem;
    border: 1px solid var(--color-gray-300);
    border-radius: 0.5rem;
    background: white;
    color: var(--color-gray-900);
    transition: all 0.2s ease;
    outline: none;
    resize: vertical;
    min-height: 100px;
}

.textarea:focus {
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ========================================
   6. NAVIGATION
   ======================================== */

.nav-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-500);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--color-primary-600);
    background: rgba(139, 92, 246, 0.05);
}

.nav-link.active {
    color: var(--color-primary-600);
    background: rgba(139, 92, 246, 0.1);
    font-weight: 600;
}

/* ========================================
   7. PAGE STRUCTURE
   ======================================== */

.page-header {
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    padding: 1.5rem 0;
    position: sticky;
    top: 4rem;
    z-index: 40;
    box-shadow: var(--shadow-sm);
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--color-gray-900);
    line-height: 2.25rem;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--color-gray-500);
    margin-top: 0.25rem;
}

.section-header {
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-400) 100%);
    padding: 1.5rem;
    border-radius: 0.75rem 0.75rem 0 0;
    color: white;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-header-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* ========================================
   8. STATS/METRICS
   ======================================== */

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-400) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-gray-500);
    margin-top: 0.5rem;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.stat-change.positive {
    color: var(--color-success-dark);
    background: var(--color-success-light);
}

.stat-change.negative {
    color: var(--color-error-dark);
    background: var(--color-error-light);
}

/* Trend Indicators */
.trend-up {
    color: var(--color-success);
}

.trend-down {
    color: var(--color-error);
}

/* ========================================
   9. EMPTY STATES
   ======================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    color: var(--color-gray-300);
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-gray-700);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--color-gray-500);
    max-width: 28rem;
}

/* ========================================
   10. TOOLTIPS
   ======================================== */

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-0.5rem);
    padding: 0.5rem 0.75rem;
    background: var(--color-gray-800);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 0.375rem solid transparent;
    border-top-color: var(--color-gray-800);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
}

.tooltip:hover::after {
    transform: translateX(-50%) translateY(-0.75rem);
}

/* ========================================
   11. LOADING STATES
   ======================================== */

/* NOTE: .page-loading-overlay and .page-loading-spinner are defined in global.css */

/* Loading Skeleton */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 0.375rem;
}

.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Spinner for inline loading */
.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--color-primary-200);
    border-top-color: var(--color-primary-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

.spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

/* ========================================
   12. ERROR & STATUS BANNERS
   ======================================== */

.error-banner {
    background-color: var(--color-error-light);
    border-left: 4px solid #dc2626;
    padding: 1rem;
    border-radius: 0.5rem;
}

.success-banner {
    background-color: var(--color-success-light);
    border-left: 4px solid var(--color-success);
    padding: 1rem;
    border-radius: 0.5rem;
}

.warning-banner {
    background-color: var(--color-warning-light);
    border-left: 4px solid var(--color-warning);
    padding: 1rem;
    border-radius: 0.5rem;
}

.info-banner {
    background-color: var(--color-info-light);
    border-left: 4px solid var(--color-info);
    padding: 1rem;
    border-radius: 0.5rem;
}

/* ========================================
   13. PROGRESS BARS
   ======================================== */

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: var(--color-gray-200);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-400) 100%);
    transition: width 0.3s ease;
}

.progress-fill.success {
    background: var(--color-success);
}

.progress-fill.warning {
    background: var(--color-warning);
}

.progress-fill.error {
    background: var(--color-error);
}

/* ========================================
   UTILITY ANIMATIONS
   ======================================== */

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

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

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

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

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

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

/* Hover lift effect */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

/* Pulse glow animation for primary buttons */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    }
    50% {
        box-shadow: 0 8px 24px rgba(139, 92, 246, 0.6);
    }
}

.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}
