/**
 * Baby Sleep Schedule Generator - Styles
 * Baby/Parenting themed design with pastel colors
 */

/* ==================== Reset & 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, #e3f2fd 0%, #fce4ec 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ==================== Container ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ==================== Header ==================== */
.header {
    background: linear-gradient(135deg, #81c784 0%, #a5d6a7 100%);
    padding: 40px 30px;
    text-align: center;
    color: white;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
}

/* ==================== Main Content ==================== */
.main-content {
    padding: 40px 30px;
}

/* ==================== Form Section ==================== */
.form-section {
    background: #f8fdf9;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 2px solid #c8e6c9;
}

.form-section h2 {
    color: #2e7d32;
    margin-bottom: 25px;
    font-size: 1.8em;
}

/* ==================== Form Groups ==================== */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2e7d32;
    font-size: 1em;
}

.required {
    color: #e53935;
    margin-left: 3px;
}

.form-group input[type="number"],
.form-group input[type="time"],
.form-group input[type="email"],
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #c8e6c9;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #66bb6a;
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-with-unit input {
    flex: 1;
}

.unit {
    color: #666;
    font-weight: 500;
}

.help-text {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9em;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ==================== Buttons ==================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #66bb6a 0%, #81c784 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 187, 106, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 187, 106, 0.4);
}

.btn-secondary {
    background: white;
    color: #66bb6a;
    border: 2px solid #66bb6a;
}

.btn-secondary:hover {
    background: #66bb6a;
    color: white;
}

.btn-large {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
}

/* ==================== Results Section ==================== */
.results-section {
    animation: fadeIn 0.5s ease-in;
}

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

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h2 {
    color: #2e7d32;
    font-size: 2em;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-buttons-bottom {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 30px 0;
    padding: 20px;
    background: #f8fdf9;
    border-radius: 12px;
    border: 2px solid #c8e6c9;
}

/* ==================== Recommendations Box ==================== */
.recommendations-box {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    border-left: 5px solid #fbc02d;
}

.recommendations-box h3 {
    color: #f57f17;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.rec-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rec-item strong {
    display: block;
    color: #f57f17;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.rec-item p {
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
}

.notes {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.notes strong {
    color: #f57f17;
}

/* ==================== Daily Schedule ==================== */
.daily-schedule {
    margin-bottom: 30px;
}

.daily-schedule h3 {
    color: #2e7d32;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.schedule-table {
    overflow-x: auto;
}

.schedule-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.schedule-table thead {
    background: linear-gradient(135deg, #64b5f6 0%, #90caf9 100%);
    color: white;
}

.schedule-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.schedule-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.schedule-table tbody tr:hover {
    background: #f5f5f5;
}

.time-cell {
    font-weight: 600;
    color: #1976d2;
    white-space: nowrap;
}

.activity-cell {
    color: #333;
}

/* ==================== Info Boxes ==================== */
.info-box {
    background: linear-gradient(135deg, #e1bee7 0%, #f3e5f5 100%);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 5px solid #8e24aa;
}

.info-box h3 {
    color: #6a1b9a;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.info-box p {
    margin-bottom: 10px;
    line-height: 1.8;
}

.info-box ul {
    padding-left: 20px;
    margin-top: 10px;
}

.info-box li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.sleep-note {
    margin-top: 15px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    font-style: italic;
}

/* ==================== Safe Sleep Box ==================== */
.safe-sleep-box {
    background: linear-gradient(135deg, #ffccbc 0%, #ffe0b2 100%);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 5px solid #ff6f00;
}

.safe-sleep-box h3 {
    color: #e65100;
    margin-bottom: 20px;
    font-size: 1.4em;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.tip-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tip-item p {
    margin: 0;
    line-height: 1.6;
}

/* ==================== Modal ==================== */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 20px 0;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    position: relative;
    margin: auto;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.modal-content h3 {
    color: #2e7d32;
    margin-bottom: 20px;
}

#emailStatus {
    margin-top: 15px;
}

#emailStatus .success {
    color: #2e7d32;
    background: #c8e6c9;
    padding: 10px;
    border-radius: 5px;
}

#emailStatus .error {
    color: #c62828;
    background: #ffcdd2;
    padding: 10px;
    border-radius: 5px;
}

#emailStatus .info {
    color: #1565c0;
    background: #bbdefb;
    padding: 10px;
    border-radius: 5px;
}

/* ==================== Loading Indicator ==================== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #66bb6a;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

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

.loading p {
    margin-top: 20px;
    color: #2e7d32;
    font-size: 1.2em;
    font-weight: 600;
}

/* ==================== Footer ==================== */
.footer {
    background: #fff9c4;
    padding: 25px;
    border-top: 3px solid #fbc02d;
    margin-top: 30px;
}

.footer p {
    margin: 0;
    color: #666;
    line-height: 1.8;
    text-align: center;
}

.footer strong {
    color: #f57f17;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 10px;
    }

    .header {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .main-content {
        padding: 20px 15px;
    }

    .form-section {
        padding: 20px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-buttons {
        width: 100%;
    }

    .action-buttons .btn {
        flex: 1;
        min-width: 120px;
    }

    .action-buttons-bottom {
        width: 100%;
        padding: 15px;
    }

    .action-buttons-bottom .btn {
        flex: 1;
        min-width: 120px;
    }

    .recommendations-grid {
        grid-template-columns: 1fr;
    }

    .tips-grid {
        grid-template-columns: 1fr;
    }

    .schedule-table {
        font-size: 0.9em;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
        max-width: 100%;
    }

    .header {
        background: white;
        color: #2e7d32;
        border-bottom: 3px solid #2e7d32;
    }

    .form-section,
    .action-buttons,
    .btn,
    .footer {
        display: none !important;
    }

    .results-section {
        display: block !important;
    }

    .recommendations-box,
    .info-box,
    .safe-sleep-box {
        background: white;
        border: 2px solid #ccc;
        page-break-inside: avoid;
    }

    .schedule-table table {
        border: 2px solid #000;
    }

    .schedule-table thead {
        background: #e0e0e0;
        color: #000;
    }

    .schedule-table td,
    .schedule-table th {
        border: 1px solid #999;
    }

    h2, h3 {
        page-break-after: avoid;
    }
}
