/* Premium Hospital Dark Mode - Based on DESIGN.md */

:root {
    /* Colors from DESIGN.md */
    --primary-text: #f0f6fc;
    --secondary-text: #8b949e;
    --accent-blue: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --danger: #ff4d4d;
    --danger-glow: rgba(255, 77, 77, 0.4);
    --bg-app: #0a0c10;
    --surface: rgba(22, 27, 34, 0.8);
    --surface-hover: rgba(33, 38, 45, 0.9);
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Layout Tokens */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --glass-blur: blur(12px) saturate(180%);
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--primary-text);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 60px;
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
    position: relative;
    overflow-x: hidden;
}

/* Watermark Background */
.bg-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 150vw;
    height: 150vw;
    background-image: url('../assets/logo.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.03; /* Muy sutil */
    filter: blur(2px);
    z-index: -1;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: rotate-drift 120s linear infinite;
}

@keyframes rotate-drift {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
    }
    50% {
        transform: translate(-45%, -55%) rotate(180deg) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1);
    }
}

/* Typography */
h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

/* Header & Logo */
.header {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    padding: 5px 20px; /* Reducido de 10px a 5px */
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px; /* Reducido de 40px a 20px para acercar el contenido */
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    height: 180px; /* Aumentado 50% (de 120px a 180px) */
    width: auto;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1));
    margin-bottom: 5px;
    transition: transform 0.5s ease;
}

.logo:hover {
    transform: scale(1.05);
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: -15px; /* Margen negativo para subir el texto */
    background: linear-gradient(135deg, #fff 0%, var(--accent-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Intro Card */
.intro-card {
    background: rgba(59, 130, 246, 0.1);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 40px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.intro-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--accent-blue);
}

.intro-card p {
    color: var(--secondary-text);
    font-size: 0.95rem;
}

/* Form Sections */
.form-section {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition);
}

.form-section:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.form-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-color) 0%, transparent 100%);
}

/* Input Groups */
.input-group {
    margin-bottom: 24px;
}

label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    color: var(--secondary-text);
}

input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--primary-text);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 640px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .form-section {
        padding: 20px;
    }
}

/* Radio Options */
.radio-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(255, 255, 255, 0.02);
    padding: 16px;
    border-radius: var(--radius-md);
}

.radio-inline {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--primary-text);
    transition: var(--transition);
}

.radio-label:hover {
    color: var(--accent-blue);
}

.radio-label input {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.radio-label input:checked {
    border-color: var(--accent-blue);
    background: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-glow);
}

.radio-label input:checked::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Signature Pad */
.signature-container {
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
    transition: var(--transition);
}

.signature-container:focus-within {
    border-color: var(--accent-blue);
}

#signaturePad {
    width: 100%;
    height: 200px;
    background: rgba(255, 255, 255, 0.02);
    cursor: crosshair;
    touch-action: none;
}

/* Buttons */
.btn-primary {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 18px 20px; /* Ajustado para que quepa bien en el grid */
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--secondary-text);
    border: 1px solid var(--border-color);
    padding: 18px 20px; /* Mismo padding vertical que el primario */
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem; /* Unificado con el estilo premium */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: var(--transition);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-text);
    border-color: var(--secondary-text);
}

/* Status & Success Messages */
.status-message, .success-message {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    padding: 48px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: var(--shadow-premium);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(59, 130, 246, 0.1);
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin: 0 auto 24px;
    box-shadow: 0 0 15px var(--accent-glow);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.success-message {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: var(--shadow-premium);
    max-width: 600px;
    margin: 2rem auto;
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.success-icon {
    width: 80px;
    height: 80px;
    background: rgba(59, 130, 246, 0.1);
    border: 2px solid var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    color: var(--accent-blue);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.2);
}

.success-icon svg {
    width: 40px;
    height: 40px;
}

.success-content h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.success-content p {
    color: var(--secondary-text);
    line-height: 1.8;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 2rem 0;
}

.farewell-text {
    font-style: italic;
    color: var(--accent-blue) !important;
    font-weight: 500;
    font-size: 1.2rem;
    margin-top: 1rem;
}

.success-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 2.5rem;
}

@media (max-width: 480px) {
    .success-actions {
        grid-template-columns: 1fr;
    }
}

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

.hidden {
    display: none !important;
}

/* Help Text */
.help-text {
    font-size: 0.85rem;
    color: var(--secondary-text);
    margin-bottom: 12px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: 5px;
    border: 2px solid var(--bg-app);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-text);
}
/* Master Token Overlay Styles */
.master-token-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-app);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.token-card {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-premium);
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.token-logo {
    height: 120px;
    margin-bottom: 20px;
}

.token-card h2 {
    margin-bottom: 12px;
    background: linear-gradient(135deg, #fff 0%, var(--accent-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.token-card p {
    color: var(--secondary-text);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.token-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 16px;
    font-weight: 500;
}
