@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Inter:wght@400;600;700&display=swap');

@font-face {
    font-family: 'clockicons';
    src: url('font/clockicons/clockicons.eot?#iefix') format('embedded-opentype'),
        url('font/clockicons/clockicons.woff2') format('woff2'),
        url('font/clockicons/clockicons.woff') format('woff'),
        url('font/clockicons/clockicons.ttf') format('truetype'),
        url('font/clockicons/clockicons.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --nav-bg: rgba(255, 255, 255, 0.8);
}

body.dark-mode {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --secondary-color: #94a3b8;
    --surface-color: #1e293b;
    --border-color: #334155;
    --nav-bg: rgba(30, 41, 59, 0.8);
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: var(--bg-color);
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
}

/* Navigation Bar */
.navbar {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.navbar h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.brand-link:hover {
    opacity: 0.8;
}

.brand-logo {
    height: 32px;
    width: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.nav-tabs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary-color);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: var(--border-color);
    color: var(--text-color);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    padding: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--border-color);
}

/* Main Container */
.main-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 2rem 5rem 2rem;
    position: relative;
    overflow-y: auto;
}

.app-section {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 900px;
    background: transparent;
    padding: 0;
    box-shadow: none;
    animation: fadeIn 0.3s ease-out;
}

.app-section.active {
    display: flex;
}

/* We put the white background on individual panels now */
.clock-display-wrapper {
    background: var(--surface-color);
    width: 100%;
    padding: 3rem;
    border-radius: 24px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.05);
    margin: 130px;
}

.app-section.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-section h2 {
    margin-top: 0;
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Clock Display */
.time-display,
.timer-display,
.stopwatch-display {
    font-family: 'clockicons', 'Share Tech Mono', monospace;
    display: flex;
    align-items: baseline;
    justify-content: center;
    margin-bottom: 1.5rem;
}

#time,
#alarm-time,
.timer-display,
#sw-time {
    font-size: 12vw;
    line-height: 1;
    letter-spacing: 2px;
    color: var(--text-color);
}

#ampm,
#alarm-ampm,
#sw-ms {
    font-size: 4vw;
    margin-left: 1.5vw;
    color: var(--secondary-color);
}

.date-display {
    font-family: 'Share Tech Mono', monospace;
    font-size: 3vw;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--secondary-color);
}

/* Inputs */
.input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.input-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.input-col label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.time-input,
.time-select {
    font-family: 'Share Tech Mono', monospace;
    font-size: 3rem;
    padding: 0.5rem;
    width: 100px;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-color);
    color: var(--text-color);
    transition: border-color 0.2s ease;
}

.time-input:focus,
.time-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.colon {
    font-family: 'Share Tech Mono', monospace;
    font-size: 4rem;
    font-weight: bold;
    color: var(--secondary-color);
}

/* Buttons */
.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.action-btn {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.secondary-btn {
    background: var(--border-color);
    color: var(--text-color);
}

.secondary-btn:hover:not(:disabled) {
    background: #cbd5e1;
}

.danger-btn {
    background: var(--danger-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.39);
}

.danger-btn:hover:not(:disabled) {
    background: var(--danger-hover);
    transform: translateY(-2px);
}

.hidden {
    display: none !important;
}

.status-msg {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Laps */
.laps-container {
    margin-top: 2rem;
    width: 100%;
    max-width: 400px;
    max-height: 200px;
    overflow-y: auto;
}

#laps-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#laps-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.2rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface-color);
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.modal-header {
    background: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--bg-color);
}

.center-footer {
    justify-content: center;
}

/* Red Modal for Trigger */
.red-modal .modal-header {
    background: var(--danger-color);
}

.red-modal .modal-body {
    background: var(--surface-color);
}

.bell-animation {
    font-size: 4rem;
    animation: shake 0.5s infinite;
    color: var(--danger-color);
}

@keyframes shake {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(15deg);
    }

    50% {
        transform: rotate(0deg);
    }

    75% {
        transform: rotate(-15deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

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

.mt-4 {
    margin-top: 2rem;
}

.mt-2 {
    margin-top: 1rem;
}

.sm-btn {
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

/* Active Alarm Panel */
.active-alarm-panel {
    margin-top: 2rem;
    width: 100%;
    max-width: 400px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.active-alarm-panel h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.active-alarm-time {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
}

.active-alarm-countdown {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.2rem;
    color: var(--secondary-color);
}

/* Alarm Form UI */
.alarm-form {
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.half-width {
    flex: 1;
    min-width: 150px;
}

.full-width {
    flex: 1 1 100%;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.stepper-group {
    display: flex;
    height: 3rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-color);
}

.stepper-btn {
    background: transparent;
    border: none;
    padding: 0 1rem;
    cursor: pointer;
    color: var(--text-color);
    font-size: 1.2rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stepper-btn:hover {
    background: var(--border-color);
}

.stepper-select {
    flex: 1;
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    padding: 0 1rem;
    appearance: none;
    outline: none;
    text-align: center;
    cursor: pointer;
}

.sound-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.sound-group .stepper-select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    height: 3rem;
    min-width: 150px;
    background: var(--surface-color);
}

.sound-group .stepper-btn {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    height: 3rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-color);
}

.checkbox-label input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.text-input {
    width: 100%;
    height: 3rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    background: var(--surface-color);
    color: var(--text-color);
    box-sizing: border-box;
}

.text-input:focus,
.stepper-select:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Responsive */
@media (min-width: 1024px) {

    #time,
    .timer-display,
    #sw-time {
        font-size: 140px;
    }

    #ampm,
    #sw-ms {
        font-size: 50px;
        margin-left: 20px;
    }

    .date-display {
        font-size: 32px;
    }
}

@media (max-width: 600px) {
    .nav-content {
        justify-content: center;
    }

    .nav-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }

    #time,
    #alarm-time,
    .timer-display,
    #sw-time {
        font-size: 18vw;
    }

    #ampm,
    #alarm-ampm,
    #sw-ms {
        font-size: 6vw;
        margin-left: 2vw;
    }

    .date-display {
        font-size: 4vw;
    }

    .time-input,
    .time-select {
        width: 70px;
        font-size: 2rem;
        padding: 0.3rem;
    }

    .colon {
        font-size: 2.5rem;
    }

    .action-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }

    .app-section {
        padding: 1.5rem;
    }
}

/* New Features Area */
.features-area {
    width: 100%;
    margin: 12rem auto 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.feature-panel {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    text-align: left;
    border: 1px solid var(--border-color);
}

.feature-panel h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: var(--secondary-color);
    font-weight: 400;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.panel-header h3 {
    margin: 0;
    border: none;
    padding: 0;
}

/* Quick Alarms Grid */
.quick-alarms-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
}

.quick-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    width: 85px;
    text-align: center;
}

.quick-btn:hover {
    background: var(--primary-hover);
}

/* Recent Alarms List */
.recent-alarms-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-alarms-list li:not(.empty-msg) {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.recent-alarms-list li a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.recent-alarms-list li a:hover {
    text-decoration: underline;
}

.recent-time {
    color: var(--text-color);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.95rem;
}

/* Instructions & Share Box */
.instructions-panel p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.share-box {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.share-url {
    width: 100%;
    max-width: 600px;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    text-align: center;
    font-size: 0.9rem;
}

.social-icons {
    display: flex;
    gap: 0.5rem;
}

.mock-social {
    width: 32px;
    height: 32px;
    background: #475569;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
}

.mock-social.fb {
    background: #3b5998;
}

.mock-social.tw {
    background: #000000;
}

.mock-social.wa {
    background: #25D366;
}

.mock-social.embed-btn {
    width: auto;
    padding: 0 1rem;
    background: var(--primary-color);
}