:root {
    --primary: #3B82F6;
    --primary-light: #60A5FA;
    --primary-dark: #1E40AF;
    --secondary: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --light: #EFF6FF;
    --light-blue: #DBEAFE;
    --dark: #1e293b;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(59, 130, 246, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(59, 130, 246, 0.1), 0 2px 4px -1px rgba(59, 130, 246, 0.06);
    --shadow-lg: 0 10px 25px rgba(59, 130, 246, 0.15);
    --shadow-xl: 0 20px 40px rgba(59, 130, 246, 0.2);
    --gradient-primary: linear-gradient(135deg, #3B82F6 0%, #1E40AF 100%);
    --gradient-light: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    overflow-x: hidden;
}

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
}

.login-body::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -200px;
    right: -200px;
    animation: float 6s ease-in-out infinite;
}

.login-body::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    bottom: -150px;
    left: -150px;
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(20px);
    }
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: var(--white);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-box h1 {
    text-align: center;
    color: var(--primary);
    font-size: 2.25rem;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-box h2 {
    text-align: center;
    color: var(--secondary);
    font-size: 1.125rem;
    font-weight: 400;
    margin-bottom: 36px;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    color: var(--secondary);
    font-size: 0.875rem;
}

/* Navbar */
.navbar {
    background: var(--white);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--light-blue);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.3s ease;
}

.nav-brand:hover {
    transform: scale(1.05);
}

.brand-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.3));
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--light-blue);
    transform: translateY(-1px);
}

.nav-link:active {
    transform: translateY(0);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding: 2rem 0;
    flex-wrap: wrap;
    gap: 1.5rem;
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 4px;
}

.page-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.5px;
}

.page-header p {
    color: var(--secondary);
    margin-top: 8px;
    font-size: 1.0625rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1), 0 2px 4px -1px rgba(59, 130, 246, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(59, 130, 246, 0.08);
}

.card:hover {
    box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.1), 0 10px 10px -5px rgba(59, 130, 246, 0.04);
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.2);
}

.card h2 {
    margin-bottom: 1.75rem;
    color: var(--primary);
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    padding-bottom: 12px;
}

.card h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 3px;
}

.card-header-search {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header-search h2 {
    margin: 0;
    flex: 0 0 auto;
}

.search-box {
    flex: 1;
    max-width: 400px;
    min-width: 200px;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: var(--white);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
    background: var(--light);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.75rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    background: var(--white);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1), 0 2px 4px -1px rgba(59, 130, 246, 0.06);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(59, 130, 246, 0.08);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.15), 0 10px 10px -5px rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

.metric-card.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: var(--white);
    border: none;
}

.metric-card.success::before {
    background: rgba(255, 255, 255, 0.3);
}

.metric-card.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: var(--white);
    border: none;
}

.metric-card.danger::before {
    background: rgba(255, 255, 255, 0.3);
}

.metric-icon {
    font-size: 3rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.metric-content h3 {
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.85;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="email"],
input[type="search"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--white);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
input[type="search"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
}

.btn-primary:hover {
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background: #4b5563;
    box-shadow: 0 8px 16px rgba(107, 114, 128, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: var(--white);
}

.btn-success:hover {
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: var(--white);
}

.btn-danger:hover {
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: var(--white);
}

.btn-info:hover {
    box-shadow: 0 8px 16px rgba(14, 165, 233, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: var(--white);
}

.btn-warning:hover {
    box-shadow: 0 8px 16px rgba(245, 158, 11, 0.3);
}

.btn-sm {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    border-radius: 8px;
}

.btn-xs {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-block {
    width: 100%;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
}

.table thead {
    background: var(--gradient-light);
}

.table th {
    padding: 1.125rem 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--primary-light);
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(59, 130, 246, 0.08);
    vertical-align: middle;
    color: var(--dark);
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--light);
    transform: scale(1.01);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.table-mobile {
    display: none;
}

@media (min-width: 769px) {
    .table-mobile {
        display: none !important;
    }

    .table {
        display: table !important;
    }
}

.table tbody tr:hover {
    background: var(--light);
}

.text-center {
    text-align: center;
}

/* Badges */
.badge {
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-block;
}

.badge-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.badge-secondary {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #374151;
    box-shadow: 0 2px 4px rgba(107, 114, 128, 0.2);
}

.badge-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.badge-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

/* Alerts */
.alert {
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert::before {
    content: '';
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 12px 0 0 12px;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #10b981;
    position: relative;
}

.alert-success::before {
    background: var(--success);
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #f59e0b;
    position: relative;
}

.alert-warning::before {
    background: var(--warning);
}

.alert-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #ef4444;
    position: relative;
}

.alert-error::before {
    background: var(--danger);
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border: 1px solid #3b82f6;
    position: relative;
}

.alert-info::before {
    background: var(--info);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideInUp 0.3s ease;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-blue);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary);
    font-weight: 700;
}

.modal-close {
    background: var(--light-blue);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--primary);
    color: var(--white);
    transform: rotate(90deg);
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-top: 2rem;
}

.action-btn {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.05);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: all 0.4s ease;
}

.action-btn:hover::before {
    left: 0;
    opacity: 0.05;
}

.action-btn:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.action-icon {
    font-size: 2.75rem;
    filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.2));
    transition: transform 0.3s ease;
}

.action-btn:hover .action-icon {
    transform: scale(1.1);
}

.chart-container {
    position: relative;
    height: 320px;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--light);
    border-radius: 12px;
}

code {
    background: var(--light-blue);
    padding: 0.375rem 0.625rem;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.2);
    font-weight: 500;
}

/* Responsive - Diseño Moderno */
@media (max-width: 768px) {
    .nav-container {
        padding: 0.75rem 1rem;
    }

    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        background: var(--white);
        flex-direction: column;
        padding: 1.5rem;
        box-shadow: var(--shadow-lg);
        transition: left 0.3s ease;
        z-index: 99;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-toggle {
        display: block;
        background: transparent;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
    }

    .nav-link {
        padding: 1rem 0;
        border-bottom: 1px solid var(--border);
        width: 100%;
        display: block;
        transition: all 0.2s;
    }

    .nav-link:hover {
        padding-left: 0.5rem;
        color: var(--primary);
    }

    .nav-user {
        border-left: none;
        border-top: 2px solid var(--border);
        padding-left: 0;
        padding-top: 1rem;
        margin-top: 1rem;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .container {
        padding: 1rem;
        max-width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem 0;
    }

    .page-header h1 {
        font-size: 1.5rem;
        margin: 0;
    }

    .page-header button {
        width: 100%;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .metric-card {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .metric-icon {
        font-size: 2rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .card h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    /* Tablas responsive - Convertir a cards en móvil */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 
       Se eliminó el ocultamiento de .table para permitir 
       que la transformación CSS a tarjetas funcione correctamente 
       definida más abajo 
    */

    .table-mobile .table-row-mobile {
        background: var(--white);
        border-radius: 12px;
        padding: 1.25rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        border-left: 4px solid var(--primary);
    }

    .table-row-mobile .row-header {
        font-weight: 600;
        color: var(--primary);
        margin-bottom: 0.75rem;
        font-size: 1.1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .table-row-mobile .row-item {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border);
    }

    .table-row-mobile .row-item:last-child {
        border-bottom: none;
    }

    .table-row-mobile .row-label {
        font-weight: 500;
        color: var(--secondary);
        font-size: 0.875rem;
    }

    .table-row-mobile .row-value {
        font-weight: 600;
        color: var(--dark);
        text-align: right;
        flex: 1;
        margin-left: 1rem;
    }

    .table-row-mobile .row-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border);
    }

    .table-row-mobile .row-actions .btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
        margin: 0;
    }

    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
        width: 100%;
        margin-bottom: 0.5rem;
        border-radius: 8px;
        transition: all 0.2s;
    }

    .btn:last-child {
        margin-bottom: 0;
    }

    .btn-sm {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
        width: auto;
        margin-bottom: 0;
        border-radius: 6px;
    }

    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .btn-group .btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
        margin: 0;
    }

    .quick-actions {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .action-btn {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .action-icon {
        font-size: 2rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 95vh;
        border-radius: 16px;
        margin: 1rem auto;
    }

    .modal-header {
        padding: 1rem 0;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-group label {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 1rem;
        padding: 0.75rem;
        border-radius: 8px;
    }

    .chart-container {
        height: 250px;
    }

    .login-box {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .login-box h1 {
        font-size: 1.75rem;
    }

    .login-box h2 {
        font-size: 1rem;
    }

    /* Badges responsive */
    .badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        border-radius: 6px;
    }

    /* Code responsive */
    code {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        word-break: break-all;
    }
}

@media (max-width: 480px) {
    .nav-brand {
        font-size: 1.125rem;
    }

    .brand-icon {
        font-size: 1.25rem;
    }

    .container {
        padding: 0.75rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    .card {
        padding: 1rem;
        border-radius: 10px;
    }

    .table-mobile .table-row-mobile {
        padding: 1rem;
    }

    .table-row-mobile .row-header {
        font-size: 1rem;
    }

    .table-row-mobile .row-label {
        font-size: 0.8125rem;
    }

    .table-row-mobile .row-value {
        font-size: 0.875rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-icon {
        font-size: 1.75rem;
    }

    .metric-value {
        font-size: 1.25rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 0.75rem;
    }

    .btn {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }

    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .chart-container {
        height: 200px;
    }

    .modal-content {
        width: 98%;
        padding: 1.25rem;
    }

    .table-row-mobile .row-actions .btn {
        min-width: 100%;
    }
}

/* Scanner responsive */
#reader {
    width: 100% !important;
    max-width: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

#reader video {
    width: 100% !important;
    height: auto !important;
    border-radius: 12px;
}

@media (max-width: 768px) {
    #reader {
        max-width: 100%;
        border-radius: 8px;
    }

    #reader video {
        max-width: 100%;
        border-radius: 8px;
    }
}

/* Mejoras generales responsive */
@media (max-width: 1024px) {
    .container {
        padding: 1.5rem;
    }

    .card {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header button {
        width: 100%;
    }
}

/* Login responsive mejorado */
@media (max-width: 480px) {
    .login-box {
        padding: 1.5rem 1rem;
    }

    .login-box h1 {
        font-size: 1.5rem;
    }

    .login-box h2 {
        font-size: 0.9rem;
    }

    .form-group input {
        font-size: 16px;
    }
}

/* Mejoras adicionales para tablas en móvil */
@media (max-width: 768px) {
    .table thead {
        display: none;
    }

    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 0.5rem;
    }

    .table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem;
        border: none;
        text-align: right;
    }

    .table tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        margin-right: 1rem;
    }
}

@media (display-mode: standalone) {
    .navbar {
        padding-top: env(safe-area-inset-top);
    }
}

.text-muted {
    color: var(--secondary);
    font-size: 0.875rem;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 1.5rem;
    }

    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1.5rem;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.5rem;
    }

    .metric-card {
        padding: 1.25rem;
    }

    .metric-icon {
        font-size: 2rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
    }

    .card h2 {
        font-size: 1.375rem;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .card {
        padding: 2.5rem;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.9;
        transform: scale(1.05);
    }
}

.checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.socio-checkbox {
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.socio-checkbox:hover {
    background: var(--light-blue);
    transform: scale(1.1);
}

.socio-checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.socio-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.card-header-search {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .card-header-search {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .card-header-search>div {
        flex-direction: column;
        width: 100%;
    }

    .card-header-search .search-box {
        min-width: 100%;
    }

    .card-header-search button {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .checkbox-container {
        padding: 0.5rem;
        background: var(--light-blue);
        border-radius: 8px;
    }

    .socio-checkbox {
        width: 24px;
        height: 24px;
    }

    #barraSeleccionRapida {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        gap: 0.75rem;
    }

    #barraSeleccionRapida>div:first-of-type {
        font-size: 1.25rem;
    }

    #barraSeleccionRapida>div:nth-child(2) {
        width: 100%;
    }

    #barraSeleccionRapida>div:nth-child(2)>div {
        justify-content: center;
    }

    #barraSeleccionRapida>div:last-child {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    #barraSeleccionRapida>div:last-child>div {
        display: none !important;
    }

    #barraSeleccionRapida>div:last-child>div:has(button) {
        display: flex !important;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    #barraSeleccionRapida button {
        width: 100%;
        margin-bottom: 0;
    }

    #badgeSeleccion {
        font-size: 0.6875rem !important;
        padding: 0.25rem 0.5rem !important;
    }
}

.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.accordion-item {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accordion-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.accordion-item.active {
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.15);
}

.accordion-header {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: var(--white);
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
}

.accordion-header::after {
    content: '👆 Haz clic para ver detalles';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.accordion-header:hover::after {
    opacity: 0.95;
}

.accordion-item.active .accordion-header::after,
.accordion-item.seen .accordion-header::after {
    display: none;
}

.accordion-header:hover {
    background: var(--light-blue);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.accordion-item.active .accordion-header {
    background: var(--light-blue);
    border-bottom: 2px solid var(--primary);
}

.accordion-item.first-item .accordion-header {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border: 2px dashed var(--primary);
    position: relative;
    animation: pulseFirst 2s ease-in-out infinite;
}

@keyframes pulseFirst {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
}

.accordion-item.first-item .accordion-header::before {
    content: '💡 Ejemplo';
    position: absolute;
    top: -12px;
    left: 1rem;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 5;
}

.accordion-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.socio-foto-mini {
    flex-shrink: 0;
}

.socio-foto-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.socio-foto-thumb-placeholder {
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 50%;
    border: 2px solid #d1d5db;
    font-size: 1.5rem;
    color: #6b7280;
}

.socio-info-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.socio-nombre {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--dark);
    transition: color 0.3s ease;
}

.accordion-header:hover .socio-nombre {
    color: var(--primary);
}

.socio-info-subtitle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
    color: var(--secondary);
    flex-wrap: wrap;
}

.accordion-icon {
    font-size: 1.25rem;
    color: var(--primary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.socio-details {
    padding: 1.5rem;
    background: var(--light);
}

.socio-foto-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.socio-foto {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    border: 3px solid var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.socio-foto:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.socio-foto-placeholder {
    width: 150px;
    height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 12px;
    border: 3px dashed #9ca3af;
    color: #6b7280;
    font-size: 0.875rem;
    gap: 0.5rem;
}

.detail-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.detail-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--dark);
}

.socio-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border);
}

.socio-actions .btn {
    flex: 1;
    min-width: 150px;
}

@media (max-width: 768px) {
    .accordion-header {
        padding: 1rem;
    }

    .accordion-header::after {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        white-space: normal;
        max-width: 200px;
        text-align: center;
    }

    .accordion-item.first-item .accordion-header::before {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
        top: -10px;
        left: 0.75rem;
    }

    .socio-nombre {
        font-size: 1rem;
    }

    .socio-info-subtitle {
        font-size: 0.875rem;
    }

    .socio-details {
        padding: 1rem;
    }

    .socio-foto-container {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }

    .socio-foto,
    .socio-foto-placeholder {
        width: 120px;
        height: 120px;
    }

    .socio-foto-placeholder span:first-child {
        font-size: 2.5rem;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .socio-actions {
        flex-direction: column;
    }

    .socio-actions .btn {
        width: 100%;
        min-width: 100%;
    }

    .accordion-icon {
        font-size: 1rem;
    }

    #guiaInicial {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    #guiaInicial button {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .accordion-header {
        padding: 0.875rem;
    }

    .accordion-header::after {
        content: '👆 Toca aquí';
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
    }

    .accordion-item.first-item .accordion-header {
        border-width: 1px;
    }

    .accordion-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .socio-foto-thumb,
    .socio-foto-thumb-placeholder {
        width: 40px;
        height: 40px;
    }

    .socio-foto-thumb-placeholder {
        font-size: 1.25rem;
    }

    .socio-info-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .socio-info-subtitle {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .socio-info-subtitle span:not(:first-child):before {
        content: '';
        display: none;
    }

    .detail-item {
        padding: 0.75rem;
        background: white;
        border-radius: 8px;
    }

    #guiaInicial {
        font-size: 0.875rem;
    }

    #guiaInicial>div:first-of-type {
        font-size: 1.5rem;
    }
}