/* ========================================
RESET
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2E7D32;
    --primary-dark: #1B5E20;
    --bg: #F5F7FB;
    --card: #FFFFFF;
    --text: #1F2937;
    --text-light: #6B7280;
    --danger: #D32F2F;
    --radius: 24px;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ========================================
HEADER
======================================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 18px 20px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(0, 0, 0, .05);
}

.topbar h2 {
    font-size: 28px;
    font-weight: 700;
}

/* ========================================
DASHBOARD
======================================== */
.next-alarm-card {
    margin: 20px;
    padding: 26px;
    border-radius: 32px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, .18);
}

.next-title {
    opacity: .8;
    font-size: 14px;
}

.next-icon {
    margin-top: 10px;
    font-size: 42px;
}

.next-time {
    font-size: 58px;
    font-weight: 700;
    margin-top: 10px;
}

.next-label {
    margin-top: 8px;
    font-size: 22px;
}

.next-date {
    margin-top: 8px;
    opacity: .8;
}

.next-countdown {
    margin-top: 18px;
    display: inline-block;
    background: rgba(255, 255, 255, .15);
    padding: 10px 18px;
    border-radius: 50px;
}

/* ========================================
LIST
======================================== */
.alarm-list {
    padding: 20px;
    padding-bottom: 120px;
}

/* ========================================
DELETE
======================================== */
.alarm-item {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    margin-bottom: 16px;
}

.delete-area {
    position: absolute;
    inset: 0;
    background: var(--danger);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 22px;
}

.delete-btn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: white;
    color: var(--danger);
    font-size: 18px;
}

/* ========================================
CARD
======================================== */
.alarm-card {
    position: relative;
    background: var(--card);
    border-radius: 28px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    transition: .25s;
}

.alarm-card:active {
    transform: scale(.98);
}

.alarm-time {
    font-size: 42px;
    font-weight: 700;
    min-width: 100px;
}

.alarm-info {
    flex: 1;
    margin-left: 16px;
}

.alarm-repeat {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 4px;
}

.alarm-label {
    color: #9CA3AF;
}

/* ========================================
SWITCH
======================================== */
.switch {
    position: relative;
    width: 56px;
    height: 32px;
    display: inline-block;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    inset: 0;
    background: #D1D5DB;
    border-radius: 50px;
    transition: .3s;
}

.slider:before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    left: 4px;
    top: 4px;
    border-radius: 50%;
    background: white;
    transition: .3s;
}

.switch input:checked + .slider {
    background: var(--primary);
}

.switch input:checked + .slider:before {
    transform: translateX(24px);
}

/* ========================================
FAB
======================================== */
.fab {
    position: fixed;
    right: 22px;
    bottom: 24px;
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 22px;
    z-index: 500;
    box-shadow: 0 12px 24px rgba(46, 125, 50, .35);
}

.fab:active {
    transform: scale(.95);
}

/* ========================================
OVERLAY
======================================== */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    opacity: 0;
    visibility: hidden;
    transition: .3s;
    z-index: 998;
}

.sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
BOTTOM SHEET
======================================== */
.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -100%;
    background: white;
    border-radius: 32px 32px 0 0;
    padding: 22px;
    transition: .35s;
    z-index: 999;
    max-height: 90vh;
    overflow: auto;
}

.bottom-sheet.active {
    bottom: 0;
}

.sheet-handle {
    width: 60px;
    height: 6px;
    background: #D1D5DB;
    border-radius: 50px;
    margin: 0 auto 18px;
}

.bottom-sheet h3 {
    text-align: center;
    margin-bottom: 20px;
}

.time-picker {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.time-picker input {
    width: 90px;
    height: 72px;
    border: none;
    border-radius: 20px;
    background: #F3F4F6;
    text-align: center;
    font-size: 34px;
}

.time-picker span {
    font-size: 34px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-light);
}

.form-group input,
.form-group select {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 16px;
    background: #F3F4F6;
    padding: 0 16px;
    font-size: 16px;
}

/* ========================================
REPEAT DAYS
======================================== */
.repeat-section {
    margin-bottom: 20px;
}

.repeat-section label {
    display: block;
    margin-bottom: 12px;
    color: var(--text-light);
}

.repeat-days {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.day-chip {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #ECEFF1;
    font-size: 13px;
    font-weight: 600;
}

.day-chip.active {
    background: var(--primary);
    color: white;
}

/* ========================================
OPTION ROW
======================================== */
.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

/* ========================================
SAVE
======================================== */
.save-btn {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: 18px;
    background: var(--primary);
    color: white;
    font-size: 16px;
    font-weight: 700;
}

/* ========================================
FULLSCREEN ALARM
======================================== */
.alarm-popup {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: .35s;
    z-index: 99999;
}

.alarm-popup.show {
    visibility: visible;
    opacity: 1;
}

.alarm-content {
    width: 90%;
    text-align: center;
    color: white;
}

.alarm-icon {
    font-size: 72px;
    margin-bottom: 28px;
    animation: ring 1.2s infinite;
}

.alarm-clock {
    font-size: 72px;
    font-weight: 700;
}

.alarm-title {
    margin-top: 10px;
    font-size: 30px;
}

.alarm-message {
    margin-top: 10px;
    opacity: .9;
}

.alarm-buttons {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.alarm-buttons button {
    height: 58px;
    border: none;
    border-radius: 18px;
    font-size: 18px;
    font-weight: 700;
}

#btnSnooze {
    background: rgba(255, 255, 255, .15);
    color: white;
}

#btnStop {
    background: white;
    color: var(--primary);
}

@keyframes ring {
    0% { transform: rotate(-12deg); }
    25% { transform: rotate(12deg); }
    50% { transform: rotate(-12deg); }
    75% { transform: rotate(12deg); }
    100% { transform: rotate(0); }
}

/* ========================================
DARK MODE
======================================== */
@media (prefers-color-scheme: dark) {
    body {
        background: #121212;
        color: white;
    }

    .topbar {
        background: rgba(30, 30, 30, .9);
    }

    .alarm-card,
    .bottom-sheet {
        background: #1E1E1E;
    }

    .form-group input,
    .form-group select,
    .time-picker input {
        background: #2A2A2A;
        color: white;
    }
}

/* ========================================
FEATURE CARD
======================================== */
.feature-card {
    margin: 16px;
    background: linear-gradient(135deg, #1B5E20, #2E7D32);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .15);
}

.feature-card a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    color: white;
    text-decoration: none;
}

.feature-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.feature-left i {
    font-size: 32px;
}

.feature-left h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.feature-left p {
    font-size: 13px;
    opacity: .85;
}