/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #8b5abf 50%, #a855f7 75%, #9333ea 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    color: #333;
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    overflow: visible;
    animation: slideUp 0.6s ease-out;
}

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

/* Header */
header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(168, 85, 247, 0.95) 100%);
    color: white;
    padding: 32px 24px;
    text-align: center;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 500;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.subtitle {
    opacity: 0.92;
    font-size: 1rem;
    font-weight: 300;
    line-height: 1.5;
}

/* Star decorations */
.stars-top {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
}

.stars-bottom {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    margin-bottom: 8px;
}

.star {
    font-size: 1.2rem;
    animation: twinkle 2s infinite ease-in-out;
    opacity: 0.8;
}

.star.small {
    font-size: 0.9rem;
}

.star:nth-child(1) { animation-delay: 0s; }
.star:nth-child(2) { animation-delay: 0.4s; }
.star:nth-child(3) { animation-delay: 0.8s; }
.star:nth-child(4) { animation-delay: 1.2s; }
.star:nth-child(5) { animation-delay: 1.6s; }

@keyframes twinkle {
    0%, 100% { 
        opacity: 0.4;
        transform: scale(0.8);
    }
    50% { 
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Main content */
main {
    padding: 30px 20px;
}

.calculator-section {
    margin-bottom: 40px;
}

.calculator-section h2 {
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 20px;
    text-align: center;
}

/* Tab Navigation */
.tab-container {
    display: flex;
    margin: 0 20px 30px 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    padding: 4px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.tab-button {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-button.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tab-button:hover:not(.active) {
    color: #475569;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Time input group */
.time-input-group {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    justify-content: center;
    align-items: center;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-separator {
    font-size: 1.5rem;
    font-weight: 600;
    color: #475569;
    margin: 0 8px;
}

select {
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    font-size: 1.1rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

select:hover {
    border-color: #d1d5db;
}

select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Buttons */
.primary-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
    min-width: 200px;
    text-transform: capitalize;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.primary-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #5b6cfa 0%, #8b5abf 100%);
}

.primary-button:active {
    transform: translateY(0);
}

/* Current time display */
.current-time-display {
    text-align: center;
    margin: 20px 0 30px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

#current-time-text {
    font-size: 1.8rem;
    font-weight: 600;
    color: #667eea;
    display: block;
}

/* Results section */
.results-section {
    background: #f8fafc;
    border-radius: 16px;
    padding: 28px 24px;
    margin: 30px 20px 20px 20px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.results-section h3 {
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

.results-list {
    display: grid;
    gap: 12px;
}

.result-item {
    background: white;
    padding: 18px 24px;
    border-radius: 12px;
    border: 2px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    opacity: 0;
    animation: fadeInUp 0.4s ease-out forwards;
}

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

.result-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #d1d5db;
}

.result-time {
    font-size: 1.3rem;
    font-weight: 600;
    color: #667eea;
    letter-spacing: 0.5px;
}

.result-label {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

.sleep-info {
    text-align: center;
    margin-top: 20px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.12);
    border-radius: 10px;
    border: 1px solid rgba(102, 126, 234, 0.25);
}

.sleep-info p {
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
}

/* Footer */
footer {
    background: rgba(248, 250, 252, 0.8);
    padding: 24px;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.info-text {
    color: #64748b;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

.info-text strong {
    color: #334155;
    font-weight: 600;
}

.copyright {
    color: #334155;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 20px;
    padding: 20px 0;
    border-top: 2px solid rgba(226, 232, 240, 1);
    font-weight: 600;
    background-color: rgba(248, 250, 252, 0.9);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.copyright-standalone {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.6rem;
    text-align: center;
    margin: 25px auto 35px auto;
    padding: 12px 20px;
    max-width: 480px;
    font-weight: 300;
    background: none;
    border: none;
    letter-spacing: 0.5px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.copyright-standalone:hover {
    opacity: 1;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    body {
        padding: 8px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 30%, #8b5abf 60%, #a855f7 100%);
    }

    .container {
        border-radius: 18px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
        background: rgba(255, 255, 255, 0.98);
    }

    header {
        padding: 32px 20px;
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(168, 85, 247, 0.95) 100%);
    }

    .stars-top {
        gap: 15px;
        margin-bottom: 12px;
    }

    .stars-bottom {
        gap: 12px;
        margin-top: 8px;
        margin-bottom: 6px;
    }

    .star {
        font-size: 1rem;
    }

    .star.small {
        font-size: 0.8rem;
    }

    header h1 {
        font-size: 2.1rem;
        margin-bottom: 14px;
    }

    .subtitle {
        font-size: 1.05rem;
        line-height: 1.4;
    }

    main {
        padding: 30px 18px;
    }

    .tab-container {
        margin: 0 8px 30px 8px;
        background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    }

    .tab-button {
        padding: 14px 16px;
        font-size: 1rem;
        font-weight: 600;
    }

    .tab-button.active {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }

    .calculator-section h2 {
        font-size: 1.4rem;
        margin-bottom: 25px;
        color: #1f2937;
    }

    .time-input-group {
        gap: 8px;
        margin-bottom: 35px;
    }

    select {
        padding: 16px 18px;
        min-width: 75px;
        font-size: 1.1rem;
        border-radius: 14px;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    }

    .time-separator {
        font-size: 1.4rem;
        margin: 0 8px;
        color: #374151;
    }

    .primary-button {
        padding: 18px 32px;
        min-width: 200px;
        font-size: 1.05rem;
        border-radius: 50px;
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
        margin-top: 10px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .primary-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
        background: linear-gradient(135deg, #5b6cfa 0%, #8b5abf 100%);
    }

    .current-time-display {
        margin: 20px 0 30px 0;
        padding: 22px;
        background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
        border: 2px solid #cbd5e1;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }

    #current-time-text {
        font-size: 1.8rem;
        font-weight: 700;
        color: #667eea;
    }

    .results-section {
        margin: 30px 8px 20px 8px;
        padding: 26px 20px;
        border-radius: 18px;
        background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    }

    .results-section h3 {
        font-size: 1.25rem;
        margin-bottom: 24px;
    }

    .result-item {
        padding: 20px 24px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
        border-radius: 14px;
        margin-bottom: 8px;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
    }

    .result-time {
        font-size: 1.5rem;
        font-weight: 700;
        margin-bottom: 4px;
    }

    .result-label {
        font-size: 0.95rem;
        font-weight: 500;
    }

    .sleep-info {
        margin-top: 24px;
        padding: 18px;
        border-radius: 12px;
        background: rgba(102, 126, 234, 0.12);
        border: 1px solid rgba(102, 126, 234, 0.25);
    }

    .sleep-info p {
        font-size: 0.95rem;
        font-weight: 600;
        color: #667eea;
    }

    footer {
        padding: 24px 18px;
        background: rgba(248, 250, 252, 0.9);
    }

    .info-text {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .copyright {
        font-size: 0.8rem;
        padding: 12px 0;
        margin-top: 16px;
    }

    .copyright-standalone {
        margin: 20px 10px 30px 10px;
        padding: 10px 15px;
        font-size: 0.55rem;
    }
}

@media (max-width: 350px) {
    body {
        padding: 6px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .stars-top {
        gap: 12px;
        margin-bottom: 10px;
    }

    .stars-bottom {
        gap: 10px;
        margin-top: 6px;
        margin-bottom: 4px;
    }

    .star {
        font-size: 0.9rem;
    }

    .star.small {
        font-size: 0.7rem;
    }

    main {
        padding: 25px 14px;
    }

    .calculator-section h2 {
        font-size: 1.25rem;
    }

    .time-input-group {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        margin-bottom: 30px;
    }

    .input-wrapper {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }

    select {
        width: 100%;
        min-width: 80px;
        font-size: 1rem;
        padding: 14px 16px;
    }

    .time-separator {
        display: none;
    }

    .primary-button {
        min-width: 170px;
        padding: 16px 28px;
        font-size: 1rem;
    }

    .current-time-display {
        margin: 18px 0 28px 0;
        padding: 20px;
    }

    #current-time-text {
        font-size: 1.6rem;
        color: #667eea;
    }

    .results-section {
        margin: 25px 6px 18px 6px;
        padding: 22px 16px;
    }

    .result-time {
        font-size: 1.3rem;
    }

    .result-label {
        font-size: 0.9rem;
    }

    .copyright {
        font-size: 0.75rem;
        padding: 10px 0;
        margin-top: 12px;
    }

    .copyright-standalone {
        margin: 15px 8px 25px 8px;
        padding: 8px 12px;
        font-size: 0.5rem;
    }
}
