/* Base Variables */
:root {
    --color-bg: #FDFBF7; /* Crema muy pálido / Marfil */
    --color-surface: #FFFFFF;
    --color-text-main: #0B1F3A; /* Azul medianoche */
    --color-text-muted: #5C6E85;
    
    --color-primary: #0B1F3A;
    --color-success: #10B981; /* Verde esmeralda */
    --color-accent: #06B6D4; /* Cian/Aguamarina */
    
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    --shadow-sm: 0 2px 8px rgba(11, 31, 58, 0.04);
    --shadow-md: 0 4px 16px rgba(11, 31, 58, 0.08);
    --shadow-lg: 0 12px 32px rgba(11, 31, 58, 0.12);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
}

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

body {
    font-family: var(--font-body);
    background: radial-gradient(circle at top left, #FFFFFF 0%, var(--color-bg) 100%);
    background-attachment: fixed;
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Layout - Mobile First */
.view-container {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--spacing-sm) var(--spacing-md);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.view-container.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Login View */
#login-view {
    justify-content: center;
    padding-bottom: 10vh;
}

.login-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg) var(--spacing-md);
    box-shadow: var(--shadow-md);
}

.brand-title {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: var(--spacing-xs);
    text-align: center;
}

.brand-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-lg);
}

/* Forms */
.input-group {
    margin-bottom: var(--spacing-sm);
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(11, 31, 58, 0.1);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-text-main);
    background: #FDFDFD;
    transition: all 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(11,31,58, 0.05);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-success) 110%);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: var(--spacing-md);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.2), transparent);
    transition: 0.5s;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:hover::after {
    left: 100%;
}

.btn-primary-small {
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-text {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Dashboard Nav */
.dashboard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.brand-title-small {
    font-size: 1.25rem;
    color: var(--color-primary);
}

/* Dashboard Header */
.dashboard-header {
    margin-bottom: var(--spacing-md);
}

.dashboard-header h1 {
    font-size: 1.75rem;
    margin-bottom: 4px;
}

.dashboard-header p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Credit Card Panel */
.credit-card-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-sm);
    position: relative;
    overflow: hidden;
}

.credit-card-info h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
}

/* Degradado cálido muy sutil en azul medianoche */
.credit-value {
    font-size: 2.5rem;
    background: linear-gradient(100deg, var(--color-primary) 60%, #906A33 120%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* Details Section */
.details-section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(11,31,58,0.05);
}

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

.detail-label {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.detail-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.status-badge {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* Action Section */
.action-section {
    margin-top: auto;
    padding-bottom: var(--spacing-lg);
}

/* ADMIN PANEL STYLES */
.admin-body {
    background: var(--color-bg);
}

.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--spacing-sm) var(--spacing-md);
}

.admin-nav {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-md);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.admin-header p {
    color: var(--color-text-muted);
}

.search-section {
    margin-bottom: var(--spacing-md);
}

.search-input {
    width: 100%;
    max-width: 400px;
}

.table-container {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.admin-table th, .admin-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid rgba(11,31,58,0.05);
}

.admin-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.admin-table td {
    font-size: 0.95rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(11,31,58, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    z-index: 100;
}

.modal-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
}

.token-preview {
    margin-top: -8px;
    margin-bottom: var(--spacing-sm);
    font-size: 0.85rem;
    color: var(--color-success);
    font-weight: 600;
}

/* Feedbacks */
.error-message {
    background: #FEE2E2;
    color: #DC2626;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: var(--spacing-sm);
    text-align: center;
}

.feedback-message {
    background: #D1FAE5;
    color: #059669;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
    text-align: center;
    font-weight: 500;
}

/* Loader Overlay */
.loader-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(253, 251, 247, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(11,31,58, 0.1);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 1s ease-in-out infinite;
}

/* Security Modal Styling */
.security-modal {
    max-width: 460px;
    border-top: 4px solid var(--color-primary);
}

.security-modal-header {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.security-badge-icon {
    background: rgba(11, 31, 58, 0.08);
    color: var(--color-primary);
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.security-modal-title {
    font-size: 1.2rem;
    color: var(--color-primary);
    margin-bottom: 2px;
}

.security-modal-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.info-block {
    background: var(--color-bg);
    border: 1px solid rgba(11, 31, 58, 0.08);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.info-block-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(11, 31, 58, 0.05);
    font-size: 0.9rem;
}

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

.info-label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.info-value {
    font-weight: 600;
    color: var(--color-text-main);
    text-align: right;
}

.status-highlight {
    color: var(--color-primary);
    background: rgba(11, 31, 58, 0.06);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.technical-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(6, 182, 212, 0.08);
    color: var(--color-primary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
}

.technical-notice svg {
    flex-shrink: 0;
    color: var(--color-accent);
}
