/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #EDEEF7 0%, #E4FBFF 100%);
    min-height: 100vh;
    position: relative;
}

/* Paper Texture Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(184, 181, 255, 0.1) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.3);
}

.header__title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header__subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Navigation */
.nav {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav__list {
    display: flex;
    list-style: none;
    overflow-x: auto;
    padding: 1rem 0;
}

.nav__item {
    flex-shrink: 0;
}

.nav__button {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 25px;
    margin-right: 1rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav__button:hover {
    background: #EDEEF7;
    transform: translateY(-2px);
}

.nav__button--active {
    background: #7868E6;
    color: white;
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.3);
}

/* Main Content */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.section {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.section--active {
    display: block;
}

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

/* Search Section */
.search-container {
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #B8B5FF;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-input:focus {
    outline: none;
    border-color: #7868E6;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.2);
}

.search-button {
    padding: 1rem 1.5rem;
    background: #7868E6;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.search-button:hover {
    background: #6B5CD6;
    transform: translateY(-2px);
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-select {
    padding: 0.75rem;
    border: 2px solid #B8B5FF;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
}

/* Symptoms Grid */
.symptoms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.symptom-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 5px solid;
}

.symptom-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.symptom-card--critico {
    border-left-color: #FFB4B4;
    background: linear-gradient(135deg, white, #FFB4B4 0.1%);
}

.symptom-card--alto {
    border-left-color: #FFD700;
    background: linear-gradient(135deg, white, #FFD700 0.1%);
}

.symptom-card--moderado {
    border-left-color: #90EE90;
    background: linear-gradient(135deg, white, #90EE90 0.1%);
}

.symptom-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.symptom-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
}

.urgency-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.urgency-badge--critico {
    background: #FFB4B4;
    color: #8B0000;
}

.urgency-badge--alto {
    background: #FFD700;
    color: #B8860B;
}

.urgency-badge--moderado {
    background: #90EE90;
    color: #006400;
}

.symptom-description {
    margin-bottom: 1rem;
    color: #666;
    line-height: 1.5;
}

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

.action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
}

.action-btn--primary {
    background: #7868E6;
    color: white;
}

.action-btn--secondary {
    background: #E4FBFF;
    color: #7868E6;
    border: 1px solid #7868E6;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Emergency Section */
.emergency-header {
    text-align: center;
    margin-bottom: 2rem;
}

.emergency-header h2 {
    font-size: 2rem;
    color: #7868E6;
    margin-bottom: 0.5rem;
}

.emergency-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.emergency-btn {
    padding: 1.5rem;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.emergency-btn--critical {
    background: #FFB4B4;
    color: #8B0000;
}

.emergency-btn--warning {
    background: #FFD700;
    color: #B8860B;
}

.emergency-btn--info {
    background: #E4FBFF;
    color: #7868E6;
}

.emergency-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.emergency-info {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.emergency-info h3 {
    color: #7868E6;
    margin-bottom: 1rem;
}

.emergency-list {
    list-style: none;
}

.emergency-list li {
    padding: 0.5rem 0;
    padding-left: 2rem;
    position: relative;
}

.emergency-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #7868E6;
    font-weight: bold;
}

/* Contacts Section */
.contacts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.contacts-header h2 {
    color: #7868E6;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.contact-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.contact-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.contact-card--emergency {
    border-left: 4px solid #FFB4B4;
}

.contact-info h4 {
    color: #333;
    margin-bottom: 0.5rem;
}

.contact-info p {
    color: #666;
    font-size: 1.1rem;
}

.contact-btn {
    background: #7868E6;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.contact-btn:hover {
    background: #6B5CD6;
    transform: scale(1.1);
}

.delete-contact {
    background: #FFB4B4;
    color: #8B0000;
    margin-left: 0.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    color: #7868E6;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

/* Forms */
.form {
    padding: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #B8B5FF;
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #7868E6;
    box-shadow: 0 0 0 3px rgba(120, 104, 230, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn--primary {
    background: #7868E6;
    color: white;
}

.btn--secondary {
    background: #E4FBFF;
    color: #7868E6;
    border: 1px solid #7868E6;
}

.btn--danger {
    background: #FFB4B4;
    color: #8B0000;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* History Section */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.history-header h2 {
    color: #7868E6;
}

.history-container {
    display: grid;
    gap: 1rem;
}

.history-item {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #B8B5FF;
}

.history-date {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.history-symptom {
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
}

.history-urgency {
    font-size: 0.9rem;
}

/* Footer */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header__title {
        font-size: 2rem;
    }
    
    .header__subtitle {
        font-size: 1rem;
    }
    
    .nav__list {
        justify-content: flex-start;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .contacts-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .emergency-actions {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .symptoms-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
    }
    
    .symptom-actions {
        flex-direction: column;
    }
    
    .action-btn {
        min-width: auto;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(120, 104, 230, 0.3);
    border-radius: 50%;
    border-top-color: #7868E6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for better accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #7868E6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .symptom-card {
        border: 2px solid #333;
    }
    
    .urgency-badge {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
