@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-card: #151d30;
    --bg-card-hover: #1e2942;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --color-primary: #6366f1;
    --color-primary-glow: rgba(99, 102, 241, 0.15);
    --color-accent: #3b82f6;
    --color-success: #10b981;
    --color-success-glow: rgba(16, 185, 129, 0.1);
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Header & Navigation */
header {
    background: rgba(21, 29, 48, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.btn-nav-action {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white !important;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 600 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.btn-nav-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger) !important;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 600 !important;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--color-danger);
    color: white !important;
}

/* Layout Containers */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 1rem;
    background: radial-gradient(circle at top, var(--color-primary-glow), transparent 60%);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
    line-height: 1.2;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

/* Cards & Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    background-color: var(--bg-card-hover);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-admin {
    background-color: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-afiliado {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Forms & UI Elements */
.auth-wrapper {
    max-width: 450px;
    margin: 4rem auto;
    padding: 2.5rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

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

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

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.btn-primary {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Alert Notification box */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Lists and Tables */
.table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: rgba(0, 0, 0, 0.1);
}

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

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* ==========================================
   Sidebar & Dashboard Layout (Collapsable & Mobile-Responsive)
   ========================================== */

.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-main);
}

/* Dashboard Top Header */
.dashboard-header {
    height: 64px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    position: relative;
    z-index: 101;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.btn-icon:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.dashboard-brand {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.sidebar .dashboard-brand {
    display: block;
    text-align: center;
    width: 100%;
    margin: 0 0 2rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .dashboard-brand {
    font-size: 0.65rem;
    letter-spacing: -0.2px;
}

.user-greeting {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.btn-logout-compact {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.45rem 0.95rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

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

/* Dashboard Layout Body */
.dashboard-layout {
    display: flex;
    flex-grow: 1;
    height: calc(100vh - 64px);
    position: relative;
    overflow: hidden;
}

/* Sidebar structure */
.sidebar {
    width: 260px;
    height: 100%;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0.75rem;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 8px;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar-item a:hover,
.sidebar-item.active a {
    color: var(--text-primary);
    background-color: rgba(99, 102, 241, 0.1);
}

.sidebar-item.active a {
    border-left: 3px solid var(--color-primary);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding-left: calc(1rem - 3px);
    font-weight: 600;
}

.sidebar-item-text {
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* Collapsed Sidebar on Desktop */
.sidebar.collapsed {
    width: 70px;
    padding: 1.5rem 0.5rem;
}

.sidebar.collapsed .sidebar-item-text {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.sidebar.collapsed .sidebar-item a {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .sidebar-item.active a {
    border-left: none;
    border-radius: 8px;
    padding: 0.75rem;
    background-color: rgba(99, 102, 241, 0.15);
}

/* Content Area */
.dashboard-main {
    flex-grow: 1;
    padding: 2.5rem;
    overflow-y: auto;
    background-color: var(--bg-main);
}

/* Override container styles for dashboard usage */
.dashboard-main .container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Backdrop Overlay for mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 64px);
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
}

.sidebar-backdrop.show {
    display: block;
}

/* Responsive Rules */
@media (max-width: 767px) {
    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .dashboard-main {
        padding: 1.5rem 1rem;
    }
    
    .user-greeting {
        display: none; /* Hide welcome text on mobile to save space */
    }
}

.avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.05rem;
    color: white;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    flex-shrink: 0;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    width: 100%;
    max-width: 480px;
    margin: 1.5rem;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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