:root {
    --primary: #2b6cb0;
    --primary-light: #ebf8ff;
    --secondary: #ff4757;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --text-main: #2d3748;
    --text-muted: #718096;
    --border: #e2e8f0;
}

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

body, html {
    height: 100%;
    width: 100%;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
}

.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, var(--primary) 0%, #4299e1 100%);
    z-index: 0;
}

/* Header */
.app-header {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.25rem;
}

.logo svg {
    width: 28px;
    height: 28px;
    color: #ff4757;
    fill: #ff4757;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    background: white;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Dashboard & Form */
.dashboard {
    position: relative;
    z-index: 10;
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.clinical-record-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
}

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

.card-header h2 {
    color: var(--text-main);
    font-size: 1.5rem;
}

.badge {
    background: #ffe3e3;
    color: #c92a2a;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

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

input, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    background: #fdfdfd;
}

input[readonly] {
    background: #f1f5f9;
    color: var(--text-muted);
    cursor: not-allowed;
}

input:focus:not([readonly]), textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
    background: white;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2b6cb0;
}

/* Modal / Certificate */
.certificate-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s;
}

.certificate-modal.active {
    opacity: 1;
}

.certificate-content {
    background: white;
    width: 90%;
    max-width: 600px;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow-y: auto;
    max-height: 90vh;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 8px solid #f8f9fa;
}

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

.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 6rem;
    font-weight: 800;
    color: rgba(255, 71, 87, 0.05);
    pointer-events: none;
    z-index: 0;
}

.cert-header {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.heart-pulse {
    width: 36px;
    height: 36px;
    margin-bottom: 0.5rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.cert-header h2 {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.5rem;
    color: #1a202c;
    margin-bottom: 0.5rem;
}

.cert-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cert-body {
    position: relative;
    z-index: 1;
    margin-bottom: 1.5rem;
}

.cert-row {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border);
}

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

.cert-row strong {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

.highlight-text {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    color: var(--primary);
    line-height: 1.4;
}

#certPaciente {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.cert-footer {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 1rem;
}

.signature {
    text-align: center;
}

.sig-line {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.5rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--text-main);
    padding: 0 2rem 0.5rem;
    margin-bottom: 0.5rem;
}

.signature span {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stamp {
    border: 3px solid #ff4757;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ff4757;
    font-weight: 800;
    font-size: 0.75rem;
    transform: rotate(-15deg);
    opacity: 0.8;
}

.btn-secondary {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #edf2f7;
    color: var(--text-main);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .app-header {
        padding: 1rem;
    }
    .certificate-content {
        padding: 1.5rem;
    }
}
