/* CSS Custom Properties */
:root {
    --primary-color: #7868E6;
    --secondary-color: #B8B5FF;
    --accent-color: #FFB4B4;
    --background-color: #EDEEF7;
    --light-blue: #E4FBFF;
    --text-dark: #2c2c2c;
    --text-light: #666;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--background-color);
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(184, 181, 255, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(228, 251, 255, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(255, 180, 180, 0.2) 0%, transparent 50%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Paper Texture Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.1) 2px,
            rgba(255, 255, 255, 0.1) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.1) 2px,
            rgba(255, 255, 255, 0.1) 4px
        );
    pointer-events: none;
    z-index: -1;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.1) 10px,
        rgba(255, 255, 255, 0.1) 20px
    );
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translateX(-50px) translateY(-50px); }
    100% { transform: translateX(50px) translateY(50px); }
}

.header__title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.header__subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* Main Content */
.main {
    padding: 2rem 0;
}

/* Section Titles */
.section-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
}

/* Search Section */
.search-section {
    margin-bottom: 3rem;
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    border: 2px solid var(--secondary-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--white);
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(120, 104, 230, 0.1);
}

.search-clear {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 50%;
}

.search-clear:hover {
    background: var(--accent-color);
    color: var(--white);
}

.search-results {
    margin-top: 1rem;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 1rem;
    border-bottom: 1px solid var(--background-color);
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--light-blue);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.search-result-description {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Grid Layouts */
.audio-grid,
.cry-types-grid,
.solutions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(184, 181, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.card__title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card__description {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.card__characteristics {
    margin-bottom: 1rem;
}

.card__characteristics h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.card__characteristics ul {
    list-style: none;
    padding-left: 0;
}

.card__characteristics li {
    padding: 0.3rem 0;
    color: var(--text-light);
    position: relative;
    padding-left: 1.5rem;
}

.card__characteristics li::before {
    content: '•';
    color: var(--accent-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.card__solutions {
    background: var(--light-blue);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

.card__solutions h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.card__solutions ul {
    list-style: none;
    padding-left: 0;
}

.card__solutions li {
    padding: 0.3rem 0;
    color: var(--text-dark);
    position: relative;
    padding-left: 1.5rem;
}

.card__solutions li::before {
    content: '✓';
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Audio Cards */
.audio-card {
    background: linear-gradient(135deg, var(--white), var(--light-blue));
    border: 2px solid var(--secondary-color);
}

.audio-play-button {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    margin: 1rem auto;
    display: block;
    box-shadow: var(--shadow);
}

.audio-play-button:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.audio-play-button:active {
    transform: scale(0.95);
}

/* Emergency Section */
.emergency-section {
    margin-bottom: 3rem;
}

.emergency-card {
    background: linear-gradient(135deg, var(--accent-color), #ffcccc);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 2px solid var(--accent-color);
}

.emergency-card h3 {
    color: #d32f2f;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.emergency-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 1.5rem;
}

.emergency-list li {
    padding: 0.5rem 0;
    color: #d32f2f;
    font-weight: 500;
    position: relative;
    padding-left: 2rem;
}

.emergency-list li::before {
    content: '⚠️';
    position: absolute;
    left: 0;
}

.emergency-note {
    background: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid #d32f2f;
}

/* Audio Modal */
.audio-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.audio-modal.show {
    opacity: 1;
    visibility: visible;
}

.audio-modal__content {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: var(--shadow-hover);
}

.audio-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 50%;
}

.audio-modal__close:hover {
    background: var(--accent-color);
    color: var(--white);
}

.audio-modal__title {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.audio-player {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--border-radius);
}

.audio-play-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.audio-play-btn:hover {
    background: var(--secondary-color);
}

.audio-progress {
    flex: 1;
    height: 6px;
    background: rgba(120, 104, 230, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.audio-progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.1s ease;
}

.audio-time {
    color: var(--text-light);
    font-size: 0.9rem;
    min-width: 40px;
}

.audio-modal__description {
    color: var(--text-light);
    line-height: 1.6;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(237, 238, 247, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--secondary-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Footer */
.footer__text {
    opacity: 0.9;
    font-size: 0.9rem;
}


.footer {
  text-align: center;
  padding: 2rem 1rem;
  background: var(--primary-color);
  color: var(--light-blue);
  font-size: 0.95rem;
  line-height: 1.5;
}
.footer__links p,
.footer__disclaimer,
.footer p {
  margin: 0.5rem 0;
}


/* Responsive Design */
@media (max-width: 768px) {
    .header__title {
        font-size: 2rem;
    }
    
    .header__subtitle {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .audio-grid,
    .cry-types-grid,
    .solutions-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .audio-modal__content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .emergency-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 0;
    }
    
    .header__title {
        font-size: 1.8rem;
    }
    
    .main {
        padding: 1rem 0;
    }
    
    .search-input {
        padding: 0.8rem 2.5rem 0.8rem 0.8rem;
    }
    
    .card__title {
        font-size: 1.1rem;
    }
    
    .audio-play-button {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

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

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --secondary-color: #4169E1;
        --text-dark: #000000;
        --text-light: #333333;
    }
}

/* Focus Styles for Accessibility */
button:focus,
input:focus,
.card:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .audio-section,
    .search-section {
        display: none;
    }
    
    .main {
        padding: 0;
    }
    
    .card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}
