/* Modern Design System - Timer Clock Online */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    /* Vibrant Color Palette */
    --primary: #4361ee;
    --primary-gradient: linear-gradient(135deg, #4361ee, #3a0ca3);
    --secondary: #7209b7;
    --accent: #4cc9f0;
    --success: #4cc9f0; /* Keeping it cool/cyan for success or using distinct green */
    --success-gradient: linear-gradient(135deg, #06d6a0, #05b583);
    --warning: #f72585; /* Pinkish warning for vibrancy */
    --warning-gradient: linear-gradient(135deg, #f72585, #b5179e);
    --danger: #ef233c;
    --danger-gradient: linear-gradient(135deg, #ef233c, #d90429);
    
    /* Neutrals */
    --dark: #0f172a;
    --light: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-800: #1e293b;
    
    /* Surface & Glass */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shimmer: rgba(255, 255, 255, 0.6);
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    
    --border-radius: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark {
    --primary: #5c7cfa;
    --primary-gradient: linear-gradient(135deg, #5c7cfa, #4263eb);
    --dark: #f8fafc; /* Text switches to light */
    --light: #0f172a; /* Bg switches to dark */
    
    --glass-bg: rgba(15, 23, 42, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shimmer: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    min-height: 100vh;
    color: var(--dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    transition: background 0.5s ease;
    overflow-x: hidden;
}

body.dark {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* Background Animation */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -10%;
    left: -10%;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary);
    bottom: -5%;
    right: -5%;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation-delay: -5s;
}

.blob-3 {
    width: 200px;
    height: 200px;
    background: var(--accent);
    top: 40%;
    right: 20%;
    border-radius: 40% 60% 40% 60%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(50px, 50px) rotate(20deg); }
}

/* Layout */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass-bg);
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    box-shadow: var(--card-shadow);
}

.logo i {
    font-size: 24px;
    color: var(--primary);
    background: white;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--dark);
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(16px);
}

.icon-btn:hover {
    transform: translateY(-2px) scale(1.05);
    background: white;
    color: var(--primary);
}

body.dark .icon-btn:hover {
    background: var(--gray-800);
}

/* Cards & Glassmorphism */
.glass-panel {
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 32px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.ad-space {
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px dashed var(--glass-border);
    border-radius: var(--border-radius);
    color: var(--dark);
    margin-bottom: 24px;
    font-size: 0.9rem;
    opacity: 0.8;
}

body.dark .ad-space {
    background: rgba(0, 0, 0, 0.2);
    color: var(--light);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: var(--glass-bg);
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    margin-bottom: 32px;
    flex-wrap: wrap;
    justify-content: center;
    backdrop-filter: blur(16px);
}

.tab {
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    color: var(--dark);
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.tab.active {
    background: white;
    color: var(--primary);
    opacity: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark .tab.active {
    background: var(--primary);
    color: white;
}

.premium-badge {
    background: linear-gradient(135deg, #ffd166, #ff9e00);
    color: black;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 4px;
}

/* Content Area */
.tab-content {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 24px;
    text-align: center;
    font-weight: 700;
}

/* Display (Timer/Clock) */
.display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 6rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, var(--dark), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 32px 0;
    line-height: 1;
    letter-spacing: -2px;
    text-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

body.dark .display {
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Inputs */
.timer-inputs {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.input-group label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    opacity: 0.8;
}

.input-group input {
    width: 100px;
    height: 80px;
    border-radius: 16px;
    border: 2px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--dark);
    transition: var(--transition);
}

body.dark .input-group input {
    background: rgba(0, 0, 0, 0.2);
    color: white;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(67, 97, 238, 0.15);
}

/* Controls & Buttons */
.controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    border: none;
    padding: 16px 32px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn i {
    font-size: 1.2rem;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(67, 97, 238, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 15px 30px -5px rgba(67, 97, 238, 0.6);
    transform: translateY(-2px);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid transparent;
}

body.dark .btn-secondary {
    background: var(--gray-800);
    color: white;
}

.btn-secondary:hover {
    background: var(--gray-100);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-gradient);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(239, 35, 60, 0.4);
}

.btn-danger:hover {
    box-shadow: 0 15px 30px -5px rgba(239, 35, 60, 0.6);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-gradient);
    color: white; /* Contrast usually better with dark text on cyan, but check legibility */
    color: #0f172a;
    box-shadow: 0 10px 20px -5px rgba(76, 201, 240, 0.4);
}

.btn-success:hover {
    box-shadow: 0 15px 30px -5px rgba(76, 201, 240, 0.6);
    transform: translateY(-2px);
}

/* Presets */
.presets {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.preset-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 50px;
    color: var(--dark);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

body.dark .preset-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--gray-200);
}

.preset-btn:hover {
    background: white;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

body.dark .preset-btn:hover {
    background: var(--gray-800);
    color: var(--primary);
}

/* Laps */
.laps-container {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 24px;
    padding-right: 8px;
}

.lap-item {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: rgba(255, 255, 255, 0.3);
    margin-bottom: 8px;
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    animation: slideIn 0.3s ease;
}

body.dark .lap-item {
    background: rgba(255, 255, 255, 0.05);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Alarms */
.alarm-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.alarm-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: var(--transition);
}

.alarm-item:hover {
    transform: translateX(4px);
    border-color: var(--primary);
}

.alarm-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.alarm-status {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.status-active { color: var(--success); }
.status-inactive { color: var(--gray-200); opacity: 0.5; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--light);
    width: 90%;
    max-width: 600px;
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--card-shadow);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.modal.active .modal-content {
    transform: scale(1);
}

body.dark .modal-content {
    background: var(--gray-800);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--dark);
    opacity: 0.5;
    transition: var(--transition);
}

body.dark .modal-close {
    color: white;
}

.modal-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    font-size: 1rem;
    transition: var(--transition);
}

body.dark .form-control {
    background: rgba(0,0,0,0.2);
    border-color: var(--gray-800);
    color: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    background: white;
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    font-weight: 500;
}

.toast.active {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { border-color: #06d6a0; }
.toast.error { border-color: #ef233c; }

body.dark .toast {
    background: var(--gray-800);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .display { font-size: 3.5rem; }
    .input-group input { width: 70px; height: 60px; font-size: 1.8rem; }
    .tabs { overflow-x: auto; justify-content: flex-start; }
    .tab { white-space: nowrap; }
}
