/* ================= RESET & GLOBAL ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ================= TYPOGRAPHY ================= */
h1 {
    font-size: clamp(1.5rem, 5vw, 2.8rem);
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.2rem, 4vw, 2rem);
    line-height: 1.3;
}

h3 {
    font-size: clamp(1rem, 3vw, 1.4rem);
    line-height: 1.4;
}

p, li, a, label, input, select, button {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    line-height: 1.5;
}

/* ================= HEADER ================= */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

.header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    gap: 1rem;
}

.logo {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 800;
    background: linear-gradient(135deg, #2e7d32, #4CAF50);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    gap: clamp(1rem, 3vw, 2.5rem);
    flex-wrap: wrap;
    justify-content: center;
}

.nav-menu a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 0;
    position: relative;
    white-space: nowrap;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #4CAF50;
    transition: width 0.3s ease;
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

.nav-menu a:hover {
    color: #4CAF50;
}

/* ================= MAIN CONTENT ================= */
main {
    flex: 1;
    margin-top: 80px;
    padding: 2rem 5%;
    width: 100%;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

/* ================= HERO SECTION ================= */
.hero {
    text-align: center;
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem 1rem;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero h1 {
    background: linear-gradient(135deg, #1e3a5f, #2e7d32);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
}

.hero p {
    color: #555;
    max-width: 700px;
    margin: 0 auto;
}

/* ================= CARD MENU (HOME) ================= */
.menu-container {
    display: flex;
    justify-content: center;
    gap: clamp(1rem, 3vw, 2rem);
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 2rem auto;
}

.card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 250px;
    max-width: 350px;
    background: white;
    border-radius: 20px;
    padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 3vw, 1.8rem);
    text-decoration: none;
    color: #333;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border-top: 4px solid #4CAF50;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.card-icon {
    font-size: clamp(2.5rem, 8vw, 4rem);
    margin-bottom: 1rem;
}

.card h3 {
    color: #2e7d32;
    margin: 0.75rem 0;
}

.card p {
    color: #666;
    font-size: clamp(0.813rem, 2.2vw, 0.95rem);
    line-height: 1.5;
    margin-top: auto;
}

/* ================= FORM INPUT PAGE ================= */
.input-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    width: 100%;
    padding: 1rem;
}

.form-card {
    width: 100%;
    max-width: 550px;
    background: white;
    padding: clamp(1.5rem, 5vw, 2.5rem);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.5s ease;
}

.form-card h2 {
    text-align: center;
    color: #2e7d32;
    margin-bottom: 1.5rem;
}

.form-card label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.form-card input,
.form-card select {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-card input:focus,
.form-card select:focus {
    outline: none;
    border-color: #4CAF50;
    background: white;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    margin: 0;
    cursor: pointer;
}

.checkbox-group input {
    width: auto;
    margin: 0;
}

.form-card button {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1.5rem;
}

.form-card button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

/* ================= INFO PAGE ================= */
.info-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    width: 100%;
    padding: 1rem;
}

.info-card {
    max-width: 900px;
    width: 100%;
    background: white;
    padding: clamp(1.5rem, 5vw, 3rem);
    border-radius: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    animation: fadeInUp 0.5s ease;
}

.info-card h1 {
    text-align: center;
    color: #2e7d32;
    margin-bottom: 1.5rem;
}

.info-card p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: #444;
    text-align: justify;
}

.btn-back {
    display: inline-block;
    margin-top: 2rem;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    color: white;
    text-decoration: none;
    border-radius: 40px;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

/* ================= RESULT PAGE ================= */
.result-page {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 0 1rem;
}

.result-page h1 {
    text-align: center;
    color: #2e7d32;
    margin-bottom: 2rem;
    word-wrap: break-word;
}

/* Gizi Card */
.gizi-card {
    background: white;
    border-radius: 24px;
    padding: clamp(1rem, 4vw, 2rem);
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.gizi-card h2 {
    color: #2e7d32;
    margin-bottom: 1.5rem;
    text-align: center;
}

.gizi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.gizi-item {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: transform 0.3s ease;
}

.gizi-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.gizi-item h3 {
    color: #4CAF50;
    margin-bottom: 0.5rem;
}

.gizi-item p {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: bold;
    color: #2e7d32;
}

/* Menu Wrapper */
.menu-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.menu-card {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
    overflow-x: auto;
}

.menu-card:hover {
    transform: translateY(-5px);
}

.menu-card h3 {
    color: #4CAF50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #4CAF50;
    display: inline-block;
}

/* Menu Table */
.menu-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    min-width: 300px;
}

.menu-table th,
.menu-table td {
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(0.25rem, 1.5vw, 0.5rem);
    text-align: center;
    border: 1px solid #e0e0e0;
}

.menu-table th {
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    color: white;
    font-weight: 600;
}

.menu-table tr:nth-child(even) {
    background: #f8f9fa;
}

.menu-table tr:hover {
    background: #e8f5e9;
}

/* Total Gizi */
.total-gizi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px dashed #e0e0e0;
}

.total-item {
    background: linear-gradient(135deg, #e8f5e9, #ffffff);
    padding: 0.75rem;
    border-radius: 12px;
    text-align: center;
}

.total-item h4 {
    color: #2e7d32;
    margin-bottom: 0.5rem;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
}

.total-item p {
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: bold;
    color: #1b5e20;
}

/* ================= DATA BAYI ================= */
.data-bayi-card {
    background: white;
    border-radius: 24px;
    padding: clamp(1rem, 4vw, 2rem);
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.data-bayi-card h2 {
    text-align: center;
    color: #2e7d32;
    margin-bottom: 1.5rem;
}

.data-bayi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.data-item {
    background: linear-gradient(135deg, #e8f5e9, #ffffff);
    border-radius: 15px;
    padding: 1rem;
    text-align: center;
    border: 1px solid #d7efd9;
}

.data-item h3 {
    color: #2e7d32;
    margin-bottom: 0.5rem;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
}

.data-item p {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    font-weight: bold;
    color: #1b5e20;
    word-wrap: break-word;
}

/* ================= FOOTER ================= */
footer {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #aaa;
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
    width: 100%;
}

footer p {
    font-size: clamp(0.75rem, 2vw, 0.875rem);
}

/* ================= RESPONSIVE DESIGN ================= */

/* PERBAIKAN UNTUK SEMUA DEVICE - PAKAI !important */
@media (max-width: 768px) {
    /* Header jadi column di semua tablet & HP */
    .header-wrapper {
        flex-direction: column !important;
        padding: 0.75rem 5% !important;
        gap: 0.5rem !important;
    }
    
    .nav-menu {
        gap: 0.75rem !important;
    }
    
    .nav-menu a {
        font-size: 0.8rem !important;
    }
    
    /* PERBAIKAN UTAMA: margin-top untuk main */
    main {
        margin-top: 130px !important;
        padding: 1rem 3% 2rem 3% !important;
    }
    
    /* Perbaikan untuk result page */
    .result-page {
        padding-top: 0.5rem !important;
    }
    
    .result-page h1 {
        margin-top: 0 !important;
        padding-top: 0.5rem !important;
        font-size: 1.3rem !important;
    }
    
    /* Perbaikan card pertama */
    .gizi-card:first-child {
        margin-top: 0.5rem !important;
    }
    
    .gizi-card, .data-bayi-card {
        margin-bottom: 1rem !important;
        padding: 1rem !important;
    }
    
    /* Card home */
    .menu-container {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .card {
        width: 100% !important;
        min-width: unset !important;
        max-width: 100% !important;
    }
    
    /* Grid untuk data bayi */
    .data-bayi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    /* Grid untuk gizi */
    .gizi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    /* Menu wrapper */
    .menu-wrapper {
        grid-template-columns: 1fr !important;
    }
}

/* Layar sangat kecil (max-width: 480px) */
@media (max-width: 480px) {
    main {
        margin-top: 140px !important;
        padding: 0.5rem 2% 1.5rem 2% !important;
    }
    
    .result-page h1 {
        font-size: 1.2rem !important;
        margin-bottom: 0.75rem !important;
    }
}

/* Layar ultra kecil (max-width: 380px) */
@media (max-width: 380px) {
    main {
        margin-top: 150px !important;
    }
    
    .data-bayi-grid {
        grid-template-columns: 1fr !important;
    }
    
    .gizi-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Tablet (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    main {
        margin-top: 120px !important;
    }
}

/* Untuk desktop, header tetap row */
@media (min-width: 769px) {
    .header-wrapper {
        flex-direction: row !important;
    }
    
    main {
        margin-top: 80px !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .card:hover,
    .menu-card:hover,
    .gizi-item:hover {
        transform: none;
    }
    
    button,
    .btn-back,
    .card {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    button, 
    .btn-back,
    .card,
    .nav-menu a,
    .checkbox-group label {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Print Styles */
@media print {
    header,
    footer,
    .btn-back,
    .form-card button,
    .card,
    .menu-container {
        display: none;
    }
    
    main {
        margin-top: 0;
        padding: 0;
    }
    
    .menu-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .result-page {
        max-width: 100%;
    }
    
    body {
        background: white;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading state untuk tombol */
button:active {
    transform: scale(0.98);
}

/* Accessibility */
:focus-visible {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

/* Prevent overflow */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Word wrap untuk teks panjang */
p, h1, h2, h3, .data-item p {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ================= WHO PAGE ================= */
.who-header {
    width: 100%;
    background: white;
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.who-header h1 {
    text-align: center;
    color: #2e7d32;
    margin-bottom: 1.5rem;
}

.who-header p {
    text-align: justify;
    color: #444;
    line-height: 1.8;
}

.who-section {
    background: white;
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.who-section h2 {
    color: #2e7d32;
    text-align: center;
    margin-bottom: 1rem;
}

.who-section p {
    text-align: justify;
    color: #444;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.who-image-card {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    border: 1px solid #e5e5e5;
}

.who-image-card h3 {
    color: #2e7d32;
    margin-bottom: 1rem;
}

.who-image-card img {
    width: 100%;
    max-width: 900px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

@media (max-width: 480px) {
    .who-image-card {
        padding: 0.75rem;
    }
}