/* 
 * BISYONET - Modern Design System with Heroicons
 * Premium UI/UX Design - 2024
 */

:root {
    /* Color Palette - Premium */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-lighter: #e0e7ff;
    --primary-dark: #4f46e5;
    
    --secondary: #ec4899;
    --secondary-light: #f472b6;
    --secondary-lighter: #fbf0f7;
    
    --accent: #06b6d4;
    --accent-light: #67e8f9;
    --accent-lighter: #ecf9fd;
    
    --success: #10b981;
    --success-light: #34d399;
    --success-lighter: #ecfdf5;
    
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --warning-lighter: #fffbeb;
    
    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-lighter: #fee2e2;
    
    /* Neutrals */
    --white: #ffffff;
    --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;
    --black: #000000;
    
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    /* Sombras modernas */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Borders e Radius */
    --radius-xs: 0.25rem;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: all 0.15s ease-in-out;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: var(--bg-secondary);
    color: var(--gray-900);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 400;
}

/* ========================
   NAVBAR - HEADER
   ======================== */

.navbar-modern {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 2rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
    min-width: max-content;
}

.navbar-brand:hover {
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.navbar-brand svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
    white-space: nowrap;
    font-size: 0.9375rem;
    font-weight: 500;
    position: relative;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--primary-lighter);
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-lighter);
    font-weight: 600;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.navbar-end {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

/* Status Badge */
.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.status-badge.online {
    background: var(--success-lighter);
    color: var(--success);
}

.status-badge.offline {
    background: var(--danger-lighter);
    color: var(--danger);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-ring 2s infinite;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 2px var(--success-lighter);
}

.status-dot.offline {
    background: var(--danger);
    animation: none;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 2px var(--success-lighter), 0 0 0 6px rgba(16, 185, 129, 0.1);
    }
    50% {
        box-shadow: 0 0 0 2px var(--success-lighter), 0 0 0 12px rgba(16, 185, 129, 0.08);
    }
    100% {
        box-shadow: 0 0 0 2px var(--success-lighter), 0 0 0 6px rgba(16, 185, 129, 0.1);
    }
}

/* ========================
   MAIN CONTAINER
   ======================== */

.container-modern {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--gray-200);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

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

/* ========================
   CARDS - COMPONENTE BASE
   ======================== */

.card {
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.card-compact {
    padding: 1rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

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

/* ========================
   STAT CARDS
   ======================== */

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: var(--transition);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background: var(--primary-lighter);
    color: var(--primary);
}

.stat-icon.secondary {
    background: var(--secondary-lighter);
    color: var(--secondary);
}

.stat-icon.success {
    background: var(--success-lighter);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-lighter);
    color: var(--warning);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9375rem;
    color: var(--gray-600);
    font-weight: 500;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
}

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

.stat-change.negative {
    color: var(--danger);
}

/* ========================
   BUTTONS
   ======================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: var(--transition-fast);
}

.btn:active::before {
    width: 200px;
    height: 200px;
}

/* Button Variants */
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-900);
    border: 1px solid var(--gray-200);
}

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

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

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

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

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--primary);
}

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

.btn-danger:hover {
    background: #dc2626;
}

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

.btn-success:hover {
    background: #059669;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

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

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn svg {
    width: 18px;
    height: 18px;
}

/* ========================
   TABLES
   ======================== */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

.table thead {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9375rem;
}

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

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

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

.table-avatar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
}

/* ========================
   FORMS & INPUTS
   ======================== */

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    transition: var(--transition-fast);
    background: var(--bg-primary);
    color: var(--gray-900);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-lighter);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* ========================
   MODALS & OVERLAYS
   ======================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease-out;
}

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

/* ========================
   ALERTS & NOTIFICATIONS
   ======================== */

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.alert-success {
    background: var(--success-lighter);
    color: var(--success);
    border-left-color: var(--success);
}

.alert-warning {
    background: var(--warning-lighter);
    color: var(--warning);
    border-left-color: var(--warning);
}

.alert-danger {
    background: var(--danger-lighter);
    color: var(--danger);
    border-left-color: var(--danger);
}

.alert-info {
    background: var(--accent-lighter);
    color: var(--accent);
    border-left-color: var(--accent);
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

/* ========================
   BADGES
   ======================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

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

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

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

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

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

/* ========================
   LOADING & SPINNERS
   ======================== */

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* ========================
   RESPONSIVE
   ======================== */

@media (max-width: 768px) {
    .navbar-modern {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .navbar-nav {
        width: 100%;
        flex-wrap: wrap;
    }

    .navbar-end {
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .stat-cards {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.75rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .container-modern {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

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

    .table-wrapper {
        border-radius: var(--radius-lg);
    }
}

/* ========================   AVATARS
   ====================== */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.125rem;
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

/* ======================
   TIMELINE
   ====================== */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-item {
    display: flex;
    gap: 0.75rem;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.timeline-dot-success {
    background: var(--color-success);
}

.timeline-dot-primary {
    background: var(--color-primary);
}

.timeline-dot-warning {
    background: var(--color-warning);
}

.timeline-dot-danger {
    background: var(--color-danger);
}

.timeline-content {
    flex: 1;
}

.timeline-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-900);
}

.timeline-time {
    font-size: 0.8125rem;
    color: var(--color-gray-600);
    margin-top: 0.125rem;
}

/* ======================
   TEXT VALUES
   ====================== */
.text-value {
    font-size: 0.9375rem;
    color: var(--color-gray-900);
}

/* ======================
   GRID LAYOUTS
   ====================== */
.grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

/* ======================   UTILITIES
   ======================== */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }
.gap-4 { gap: var(--spacing-lg); }
.gap-6 { gap: var(--spacing-2xl); }

.p-2 { padding: var(--spacing-sm); }
.p-4 { padding: var(--spacing-lg); }
.p-6 { padding: var(--spacing-2xl); }

.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-6 { margin-bottom: var(--spacing-2xl); }

.mt-2 { margin-top: var(--spacing-sm); }
.mt-4 { margin-top: var(--spacing-lg); }
.mt-6 { margin-top: var(--spacing-2xl); }

.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

.text-gray-500 { color: var(--gray-500); }
.text-gray-700 { color: var(--gray-700); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.cursor-pointer { cursor: pointer; }
.cursor-disabled { cursor: not-allowed; opacity: 0.6; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
