* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

:root {
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.5);
    --bg-dark: #0f172a;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
}

body {
    background: radial-gradient(circle at top left, #1e1b4b, #0f172a);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 500px;
    z-index: 1;
}

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

@media (max-width: 640px) {
    .glass-card {
        padding: 24px 12px; /* Reduced side padding */
        border-radius: 20px;
    }
}

@media (max-width: 380px) {
    .glass-card {
        padding: 20px 8px; /* Even less padding for very small screens */
    }
}

/* Blue Theme for Calendar Mode */
.glass-card.theme-calendar {
    background: rgba(30, 64, 175, 0.95); /* Deep Blue */
    color: #ffffff;
}
.theme-calendar h1 {
    color: #ffffff;
    background: none;
    -webkit-text-fill-color: initial;
}
.theme-calendar .subtitle, 
.theme-calendar label,
.theme-calendar .mode-switch-btn {
    color: #bfdbfe; /* Light blue text */
}
.theme-calendar input, 
.theme-calendar select {
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}
.theme-calendar option {
    background: #0f172a; /* Deep dark blue for dropdown options */
    color: #fff;
}
.theme-calendar .mode-switch-btn {
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
}

h1 {
    font-size: clamp(1.8rem, 8vw, 2.8rem);
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(to right, #a78bfa, #f472b6, #a78bfa);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    animation: titleShine 4s linear infinite;
    line-height: 1.2;
}

@keyframes titleShine {
    to { background-position: 200% center; }
}

.subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 32px;
    font-size: 0.95rem;
}

.input-group {
    margin-bottom: 24px;
    padding: 5px; /* Add padding to prevent glow clipping */
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

input, select {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    color: white;
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

option {
    background: #1e1b4b; /* Deep navy for all dropdowns */
    color: white;
    font-size: 0.9rem;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow); /* Slightly smaller spread to avoid clipping */
}

.btn-calculate {
    width: 100%;
    max-width: 300px;
    margin: 20px auto 0;
    display: block;
    background: linear-gradient(135deg, var(--primary), #d946ef);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(139, 92, 246, 0.3);
}

.btn-calculate:hover {
    transform: translateY(-2px);
}

#result-area {
    margin-top: 32px;
    display: none;
    animation: fadeInUp 0.5s ease forwards;
}

.result-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--glass-border);
}

.result-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.result-day {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
}

.details {
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.detail-val {
    font-weight: 600;
    color: #e2e8f0;
}

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

.blob {
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--primary);
    filter: blur(80px);
    border-radius: 50%;
    z-index: 0;
    opacity: 0.15;
}

.blob-1 { top: 10%; left: 10%; background: #4f46e5; }
.blob-2 { bottom: 10%; right: 10%; background: #db2777; }

/* Day Name Toggling */
.short-day { display: none; }

@media (max-width: 500px) {
    .full-day { display: none; }
    .short-day { display: inline; }
}

/* Responsive Grid for Calendar */
#calendar-months-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    width: 100%;
}

@media (min-width: 1200px) {
    #calendar-months-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    #calendar-months-grid {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        gap: 20px;
        padding: 10px 5px 30px 5px;
        scrollbar-width: none; /* Hide scrollbar for clean look */
        -ms-overflow-style: none;
    }
    #calendar-months-grid::-webkit-scrollbar {
        display: none;
    }
    .month-container {
        flex: 0 0 100%; /* One month per view */
        scroll-snap-align: center;
    }
}

/* Responsive Container */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
    transition: max-width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.container:not(.wide) {
    max-width: 550px;
}

.container.wide {
    max-width: 1200px;
}

@media (max-width: 480px) {
    .calendar-day {
        padding: 4px;
    }
    .cal-date {
        font-size: 1rem;
    }
    .cal-pasaran, .cal-masehi {
        font-size: 0.5rem;
    }
    .result-day {
        font-size: 1.8rem;
    }
    .btn-calculate {
        font-size: 1rem;
        padding: 14px;
    }
    input, select {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    label {
        font-size: 0.8rem;
    }
}

/* Calendar Generation Controls */
.calendar-btn-main {
    background: linear-gradient(135deg, #facc15, #eab308) !important;
    color: #1e1b4b !important;
    margin: 20px auto 10px !important;
    display: block !important;
    width: 100% !important;
    max-width: 300px !important;
    padding: 16px !important;
    font-weight: 700;
}

.calendar-action-btns {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
}

.nav-home-btn {
    display: inline-flex !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    padding: 0 !important;
    background: rgba(255,255,255,0.05) !important;
    border-color: rgba(255,255,255,0.1) !important;
    margin: 0 !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mini-btn {
    display: none; /* Hidden by default, shown via JS if needed */
    width: auto !important;
    padding: 12px 20px !important;
    font-size: 0.9rem !important;
    margin: 0 !important;
    border-radius: 12px !important;
}

.pdf-btn { background: #10b981 !important; }
.lock-btn { background: #6366f1 !important; }

@media (max-width: 600px) {
    .calendar-action-btns {
        justify-content: center;
        width: 100%;
    }
}

/* Fix for Tablet/Desktop width in Hijri Result */
.details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

/* Carousel Navigation Buttons (Mobile/Tablet only) */
.calendar-nav-buttons {
    display: none;
    justify-content: space-between;
    width: 100%;
    margin-bottom: -40px; /* Overlap with grid for better look */
    position: relative;
    z-index: 100;
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.3s;
    font-size: 1.2rem;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .calendar-nav-buttons {
        display: flex;
        padding: 0 10px;
        margin-bottom: 10px;
    }
}

/* Mobile Scroll Hint */
@media (max-width: 768px) {
    #calendar-output::after {
        content: "← Geser untuk melihat bulan lain →";
        display: block;
        text-align: center;
        font-size: 0.75rem;
        color: #facc15;
        background: rgba(250, 204, 21, 0.1);
        padding: 8px;
        border-radius: 20px;
        margin: 10px auto 20px;
        width: fit-content;
        border: 1px solid rgba(250, 204, 21, 0.2);
        animation: pulseHint 2s infinite;
    }
}

@keyframes pulseHint {
    0% { opacity: 0.6; }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.6; }
}

.calendar-month-range {
    display: flex;
    gap: 10px;
}

.calendar-month-range .input-group {
    flex: 1;
}

@media (max-width: 400px) {
    .calendar-month-range {
        gap: 6px;
    }
}
