* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 15px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.container {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

h1 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.8rem;
    color: #00d9ff;
    flex-shrink: 0;
}

h2 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #888;
}

#sessionCount, #historyCount {
    color: #00d9ff;
}

.hidden {
    display: none !important;
}

/* Input Section */
.input-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

#eventName {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1rem;
    margin-bottom: 12px;
}

#eventName:focus {
    outline: none;
    border-color: #00d9ff;
}

#eventName::placeholder {
    color: #666;
}

#eventDescription {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 12px;
    resize: vertical;
}

#eventDescription:focus {
    outline: none;
    border-color: #00d9ff;
}

#eventDescription::placeholder {
    color: #666;
}

/* Type Selector */
.type-selector {
    display: flex;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.type-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.type-btn:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.type-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.type-btn.active[data-type="timer"] {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.type-btn.active[data-type="reminder"] {
    background: rgba(255, 149, 0, 0.2);
    color: #ff9500;
}

.type-btn.active[data-type="pomodoro"] {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
}

/* Event Options */
.event-options {
    margin-bottom: 12px;
}

.countdown-inputs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

.time-unit {
    text-align: center;
}

.time-unit input {
    width: 65px;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1.3rem;
    text-align: center;
}

.time-unit input:focus {
    outline: none;
    border-color: #00d9ff;
}

.time-unit label {
    display: block;
    margin-top: 4px;
    color: #888;
    font-size: 0.75rem;
}

/* Recent Timers */
.recent-timers {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.recent-label {
    color: #666;
    font-size: 0.8rem;
}

#recentTimersList {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.recent-timer-btn {
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: #00d9ff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.recent-timer-btn:hover {
    background: rgba(0, 217, 255, 0.2);
    border-color: #00d9ff;
}

/* DateTime Inputs */
.datetime-inputs {
    display: flex;
    gap: 8px;
}

.datetime-inputs input {
    flex: 1;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 0.95rem;
}

.datetime-inputs input:focus {
    outline: none;
    border-color: #00d9ff;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Pomodoro Inputs */
.pomodoro-inputs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.pomo-field {
    text-align: center;
}

.pomo-field input {
    width: 60px;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1.1rem;
    text-align: center;
}

.pomo-field input:focus {
    outline: none;
    border-color: #ff4444;
}

.pomo-field label {
    display: block;
    margin-top: 4px;
    color: #888;
    font-size: 0.7rem;
}

/* Sound Settings */
.sound-settings {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.sound-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sound-header span {
    font-size: 1.1rem;
}

.sound-header select {
    padding: 6px 30px 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: #1a1a2e;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%2300d9ff' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.sound-header select:focus {
    outline: none;
    border-color: #00d9ff;
}

.sound-header select option {
    background: #1a1a2e;
    color: #fff;
    padding: 8px;
}

/* Custom Upload */
.custom-upload {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.custom-upload input[type="file"] {
    display: none;
}

.upload-btn {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(0, 217, 255, 0.2);
    border: 1px solid #00d9ff;
    border-radius: 5px;
    color: #00d9ff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-btn:hover {
    background: rgba(0, 217, 255, 0.3);
}

.file-name {
    margin-left: 8px;
    color: #666;
    font-size: 0.8rem;
}

/* Sound Controls */
.sound-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sound-controls label {
    color: #888;
    font-size: 0.8rem;
}

.sound-controls input[type="range"] {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    -webkit-appearance: none;
    cursor: pointer;
}

.sound-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00d9ff;
    cursor: pointer;
}

#volumeDisplay {
    color: #00d9ff;
    font-size: 0.8rem;
    min-width: 35px;
}

.test-btn {
    padding: 5px 12px;
    border: 1px solid #00d9ff;
    border-radius: 5px;
    background: transparent;
    color: #00d9ff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.test-btn:hover {
    background: rgba(0, 217, 255, 0.2);
}

/* Add Button */
.add-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #00d9ff 0%, #00ff88 100%);
    color: #1a1a2e;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 217, 255, 0.3);
}

/* Sessions Section */
.sessions-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    transition: flex 0.3s;
}

.sessions-section h2 {
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
}

/* History Section */
.history-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    transition: flex 0.3s;
}

.history-section h2 {
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
}

/* Collapsible Sections */
.sessions-section.collapsed,
.history-section.collapsed {
    flex: 0 0 auto;
    min-height: auto;
}

.sessions-section.collapsed .scrollable-list,
.history-section.collapsed .scrollable-list {
    display: none;
}

.section-toggle {
    font-size: 0.7rem;
    margin-right: 6px;
    display: inline-block;
    transition: transform 0.2s;
    color: #666;
}

.collapsed .section-toggle {
    transform: rotate(-90deg);
}

/* Scrollable Lists */
.scrollable-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
}

.scrollable-list::-webkit-scrollbar {
    width: 5px;
}

.scrollable-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.scrollable-list::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 3px;
}

.scrollable-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 255, 0.5);
}

.session-card, .history-card {
    background: rgba(255, 255, 255, 0.08);
    padding: 12px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    border-left: 4px solid #00d9ff;
    transition: all 0.3s;
    flex-shrink: 0;
}

.session-card:hover {
    background: rgba(255, 255, 255, 0.12);
}

.session-card.timer, .history-card.timer {
    border-left-color: #00ff88;
}

.session-card.reminder, .history-card.reminder {
    border-left-color: #ff9500;
}

.session-card.pomodoro, .history-card.pomodoro {
    border-left-color: #ff4444;
}

.session-card.pomodoro.phase-work {
    border-left-color: #ff4444;
}

.session-card.pomodoro.phase-break {
    border-left-color: #00ff88;
}

.session-card.pomodoro.phase-longBreak {
    border-left-color: #4488ff;
}

.pomo-stats {
    font-size: 0.85rem;
    color: #666;
    flex: 0 0 100%;
    text-align: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pomo-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.history-card {
    opacity: 0.7;
}

.session-info, .history-info {
    flex: 1;
    min-width: 0;
}

.session-name, .history-name {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-meta, .history-meta {
    font-size: 0.75rem;
    color: #888;
}

.session-type, .history-type {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.65rem;
    margin-right: 6px;
}

.session-type.timer, .history-type.timer {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.session-type.reminder, .history-type.reminder {
    background: rgba(255, 149, 0, 0.2);
    color: #ff9500;
}

.session-type.pomodoro, .history-type.pomodoro {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
}

.session-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.session-countdown {
    font-size: 1.3rem;
    font-weight: 700;
    color: #00d9ff;
    font-family: 'Courier New', monospace;
}

.session-description {
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
    color: #aaa;
    max-height: 4em;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 8px;
    margin-top: 8px;
    line-height: 1.35;
}

.session-description::-webkit-scrollbar {
    width: 5px;
}

.session-description::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.session-description::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 3px;
}

.session-description::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 255, 0.5);
}

.repeat-btn,
.delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.repeat-btn {
    background: rgba(0, 217, 255, 0.2);
    color: #00d9ff;
}

.repeat-btn:hover {
    background: #00d9ff;
    color: #1a1a2e;
}

.popout-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: rgba(0, 217, 255, 0.15);
    color: #00d9ff;
}

.popout-btn:hover {
    background: #00d9ff;
    color: #1a1a2e;
}

.header-popout {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
    vertical-align: middle;
    margin-left: 4px;
}

.delete-btn {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
}

.delete-btn:hover {
    background: #ff4444;
    color: #fff;
}

.clear-history-btn {
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: transparent;
    color: #888;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: auto;
}

.clear-history-btn:hover {
    border-color: #ff4444;
    color: #ff4444;
}

/* Notification Button */
.notification-btn {
    width: 100%;
    padding: 10px;
    border: 2px solid #00d9ff;
    border-radius: 8px;
    background: transparent;
    color: #00d9ff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.notification-btn:hover {
    background: rgba(0, 217, 255, 0.1);
}

.notification-btn.enabled {
    background: rgba(0, 255, 136, 0.1);
    border-color: #00ff88;
    color: #00ff88;
}

.empty-state {
    text-align: center;
    padding: 20px;
    color: #555;
    font-size: 0.85rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #2a2a4e 0%, #1a1a2e 100%);
    padding: 30px;
    border-radius: 18px;
    text-align: center;
    max-width: 350px;
    width: 90%;
    border: 3px solid #ff4444;
}

.alarm-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
    animation: bounce 0.4s infinite alternate;
}

@keyframes bounce {
    from { transform: scale(1); }
    to { transform: scale(1.15); }
}

.modal-content h2 {
    font-size: 1.6rem;
    color: #ff4444;
    margin-bottom: 6px;
}

.modal-content > p {
    font-size: 1rem;
    color: #fff;
    margin-bottom: 20px;
    word-break: break-word;
}

.alarm-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.dismiss-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    background: #ff4444;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dismiss-btn:hover {
    background: #ff6666;
    transform: scale(1.05);
}

.snooze-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.snooze-controls input {
    width: 55px;
    padding: 10px 6px;
    border: 2px solid #00d9ff;
    border-radius: 6px;
    background: rgba(0, 217, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    text-align: center;
}

.snooze-controls input:focus {
    outline: none;
    background: rgba(0, 217, 255, 0.2);
}

.snooze-btn {
    padding: 12px 20px;
    border: 2px solid #00d9ff;
    border-radius: 8px;
    background: transparent;
    color: #00d9ff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.snooze-btn:hover {
    background: rgba(0, 217, 255, 0.2);
}

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

    h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .countdown-inputs {
        gap: 8px;
    }

    .time-unit input {
        width: 55px;
        padding: 8px;
        font-size: 1.1rem;
    }

    .session-countdown {
        font-size: 1.1rem;
    }

    .alarm-controls {
        flex-direction: column;
    }

    .snooze-controls {
        width: 100%;
        justify-content: center;
    }
}