:root {
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.5);
    --secondary: #4f46e5;
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.4);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.4);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

.background-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 60%);
    top: -20%;
    right: -10%;
    filter: blur(80px);
    z-index: 0;
    animation: drift 10s infinite alternate linear;
}

@keyframes drift {
    100% {
        transform: translate(-30px, 50px);
    }
}

.dashboard-container {
    width: 90%;
    max-width: 520px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem;
    z-index: 1;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

/* Tabs System */
.tabs-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: -1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem;
    border-radius: 12px;
    align-items: stretch;
    justify-content: space-between;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    text-align: center;
}

.tab-btn.active {
    background: var(--card-border);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.header-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.header-icon svg {
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.highlight {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.current-time {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    padding: 4px 16px;
    border-radius: 20px;
    border: 1px solid var(--primary-glow);
    margin: 8px 0;
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.8);
    font-family: monospace;
}

.dashboard-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 300;
}

.divider {
    border: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

/* Timer Banner */
.timer-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 1rem;
    border-radius: 16px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), inset 0 0 10px var(--success-glow);
    transition: var(--transition);
}

.timer-banner.hidden {
    display: none;
}

.timer-banner.quiet {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
    box-shadow: inset 0 0 10px var(--warning-glow);
}

/* Spinner Animation for the Timer Banner */
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.scenario-card {
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid var(--primary-glow);
}

.scenario-card .card-info h2 {
    color: #f8fafc;
}

.scenario-btn {
    position: relative;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.scenario-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

.scenario-btn:active {
    transform: translateY(0);
}

.card:hover:not(.scenario-card) {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.card-info h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.card-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition);
}

#status-text {
    font-weight: 600;
}

#status-text.active {
    color: var(--success);
    text-shadow: 0 0 8px var(--success-glow);
}

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--success);
    box-shadow: 0 0 15px var(--success-glow);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

input[type="number"],
input[type="time"],
input[type="url"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    color: white;
    font-family: inherit;
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    outline: none;
    transition: var(--transition);
    font-weight: 600;
}

input[type="number"]:focus,
input[type="time"]:focus,
input[type="url"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input[type="url"] {
    font-size: 0.95rem;
    font-weight: 400;
    color: #cbd5e1;
}

input[type="url"]::placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-weight: 300;
}

.input-wrapper .unit {
    position: absolute;
    right: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    pointer-events: none;
}

input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.6;
    transition: 0.2s;
}

input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.save-button {
    margin-top: 1rem;
    position: relative;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

.save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.save-button:active {
    transform: translateY(0);
}

.save-button span {
    position: relative;
    z-index: 2;
}

.save-button .btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
    opacity: 0;
    transition: 0.5s;
    z-index: 1;
}

.save-button:hover .btn-glow {
    opacity: 1;
    transform: rotate(30deg);
}

.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--success);
    color: var(--text-main);
    padding: 1rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px var(--success-glow);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
    backdrop-filter: blur(10px);
}

.toast.show {
    transform: translate(-50%, -140px);
}

/* History Styles */
.history-card {
    flex-direction: column;
    align-items: flex-start;
}

.history-list {
    list-style: none;
    width: 100%;
    margin-top: 1rem;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item.empty {
    color: var(--text-muted);
    font-style: italic;
    justify-content: center;
    border: none;
}

.history-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.history-msg {
    font-weight: 500;
}

.history-type-manual .history-msg {
    color: #3b82f6;
}

.history-type-auto .history-msg {
    color: var(--success);
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}