/* ==========================================================================
   ADMIN PANEL CSS - LAMAS ASESORES DE SEGUROS
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600&display=swap');

:root {
    --color-primary: #4073b0;
    --color-primary-dark: #2d5585;
    --color-primary-light: #f0f5fa;
    --color-secondary: #616160;
    --color-bg-dark: #0f172a;
    --color-bg-light: #f8fafc;
    --color-text-main: #1e293b;
    --color-text-light: #64748b;
    --color-border: #e2e8f0;
    --color-danger: #ef4444;
    --color-success: #10b981;
    --color-warning: #f59e0b;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    --radius-sm: 6px;
    --radius-md: 10px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-light);
    color: var(--color-text-main);
    line-height: 1.5;
}

/* ==========================================================================
   PANTALLA DE LOGIN
   ========================================================================== */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    background-image: radial-gradient(circle at 10% 20%, rgba(64, 115, 176, 0.05) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(64, 115, 176, 0.03) 0%, transparent 40%);
}

.login-card {
    background-color: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

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

.admin-login-logo {
    max-width: 220px;
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 1.5rem auto;
}

.login-header p {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Form Group */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(64, 115, 176, 0.15);
}

.btn-block {
    width: 100%;
    margin-top: 1rem;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    display: none;
    font-weight: 500;
}

.alert-danger {
    background-color: #fee2e2;
    color: var(--color-danger);
    border: 1px solid #fca5a5;
    display: block;
}

.alert-success {
    background-color: #d1fae5;
    color: var(--color-success);
    border: 1px solid #6ee7b7;
    display: block;
}

/* ==========================================================================
   LAYOUT DEL DASHBOARD
   ========================================================================== */
.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background-color: var(--color-bg-dark);
    color: #ffffff;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
}

.admin-sidebar-logo {
    height: 55px;
    width: auto;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

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

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link:hover, .sidebar-link.active {
    color: #ffffff;
    background-color: #1e293b;
}

.sidebar-link.active {
    background-color: var(--color-primary);
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.sidebar-user {
    padding-top: 1.5rem;
    border-top: 1px solid #1e293b;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Top Navbar */
.top-nav {
    height: 70px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
}

.top-nav-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: background-color 0.2s ease;
}

.btn-logout:hover {
    background-color: var(--color-bg-light);
    color: var(--color-danger);
    border-color: #fca5a5;
}

/* Dashboard Content */
.dashboard-content {
    padding: 2.5rem;
    flex-grow: 1;
}

/* Stats Widgets */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background-color: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-info .value {
    font-size: 2rem;
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--color-border);
    color: var(--color-text-main);
}

.btn-secondary:hover {
    background-color: var(--color-bg-light);
}

/* Data Table Card */
.table-card {
    background-color: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

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

th {
    background-color: var(--color-bg-light);
    color: var(--color-text-light);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.95rem;
    vertical-align: middle;
}

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

tr:hover td {
    background-color: rgba(64, 115, 176, 0.02);
}

.td-title {
    font-weight: 600;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background-color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.btn-edit {
    color: var(--color-primary);
}

.btn-edit:hover {
    background-color: var(--color-primary-light);
    border-color: var(--color-primary);
}

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

.btn-delete:hover {
    background-color: #fee2e2;
    border-color: var(--color-danger);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    fill: var(--color-text-light);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   MODAL DE EDICIÓN / DETALLE (FORMULARIO)
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background-color: #ffffff;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 1010;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text-light);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Form Layout Customizations */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

textarea.form-control {
    min-height: 180px;
    font-family: var(--font-body);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none; /* In production, we'd add a mobile responsive toggle menu. */
    }
    
    .top-nav {
        padding: 0 1.5rem;
    }
    
    .dashboard-content {
        padding: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}
