:root {
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #10b981;
    --success-hover: #059669;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --input-bg: #f9fafb;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: linear-gradient(135deg, var(--primary), #3730a3);
    color: white;
    padding: 30px 20px 20px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: var(--shadow);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.app-header p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 4px;
}

.app-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: -15px 20px 20px;
}

.nav-btn {
    flex: 1;
    background: var(--card-bg);
    border: none;
    padding: 12px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--text-muted);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn.active {
    color: var(--primary);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

.app-content {
    padding: 0 20px 30px;
    flex: 1;
}

.view-section {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.view-section.active {
    display: block;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 5px;
}

.card .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.row {
    display: flex;
    gap: 15px;
}

.half {
    flex: 1;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input, select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--input-bg);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background-color: #fff;
}

/* ============================================================
   Custom Analog Clock Input Triggers
   ============================================================ */
.time-input-group {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.time-picker-input {
    width: 100%;
    padding: 12px 38px 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--input-bg);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.time-input-group:hover .time-picker-input {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.time-input-icon {
    position: absolute;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s, transform 0.2s;
}

.time-input-group:hover .time-input-icon {
    color: var(--primary);
    transform: scale(1.1);
}

.info-box {
    background-color: #eff6ff;
    border-left: 4px solid var(--primary);
    padding: 10px 15px;
    border-radius: 4px;
    margin: 20px 0;
    font-size: 0.85rem;
    color: #1e3a8a;
}

.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.primary-btn {
    background-color: var(--primary);
}

.primary-btn:hover {
    background-color: var(--primary-hover);
}

.success-btn {
    background-color: var(--success);
}

.success-btn:hover {
    background-color: var(--success-hover);
}

.export-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.export-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.export-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.export-fields {
    display: none;
}

.export-fields.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.msg {
    margin-top: 15px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.msg.success { color: var(--success); }
.msg.error { color: #dc2626; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 600px) {
    .app-container {
        padding-top: 40px;
    }
    .app-header {
        border-radius: 20px 20px 0 0;
    }
}

/* ============================================================
   Round Analog Premium Clock Modal Styles
   ============================================================ */
.clock-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.clock-modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.clock-modal-card {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.9) inset;
    width: 100%;
    max-width: 330px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.92) translateY(8px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-user-select: none;
}

.clock-modal-backdrop.open .clock-modal-card {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.clock-modal-header {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #ffffff;
    padding: 18px 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.clock-modal-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
}

.clock-time-display-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.clock-digital-display {
    display: flex;
    align-items: center;
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
}

.clock-digit-btn {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 2.2rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.clock-digit-btn.active {
    background: #ffffff;
    color: #4f46e5;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    transform: scale(1.05);
}

.clock-digit-colon {
    margin: 0 4px;
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    animation: clockColonPulse 1.5s infinite ease-in-out;
}

@keyframes clockColonPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.95); }
}

/* AM / PM Segmented Switcher */
.clock-ampm-switcher {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(0, 0, 0, 0.18);
    padding: 4px;
    border-radius: 10px;
}

.clock-ampm-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 11px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.clock-ampm-btn.active {
    background: #ffffff;
    color: #4f46e5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Quick Preset Chips */
.clock-presets {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.clock-presets::-webkit-scrollbar {
    display: none;
}

.clock-preset-chip {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
}

.clock-preset-chip:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Dial Wrapper & Analog Clock Face */
.clock-dial-wrapper {
    padding: 24px 20px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffffff;
}

.clock-dial {
    position: relative;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle at center, #ffffff 0%, #f8fafc 75%, #eef2f6 100%);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 0 1px #e2e8f0;
    touch-action: none;
    cursor: pointer;
}

/* Center Pivot */
.clock-pivot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    margin-left: -5px;
    border-radius: 50%;
    background: #4f46e5;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    z-index: 10;
    pointer-events: none;
}

/* Clock Hand */
.clock-hand {
    position: absolute;
    top: 125px;
    left: 125px;
    width: 0;
    height: 0;
    transform-origin: 0 0;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 5;
    pointer-events: none;
}

.clock-hand.dragging {
    transition: none;
}

.clock-hand-stem {
    position: absolute;
    bottom: 0;
    left: -1.5px;
    width: 3px;
    height: 90px;
    background: #4f46e5;
    border-radius: 2px;
}

.clock-hand-disc {
    position: absolute;
    top: -108px;
    left: -18px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4f46e5;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}

.clock-hand-disc::after {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #ffffff;
}

/* Numbers on Dial */
.clock-numbers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.clock-number {
    position: absolute;
    width: 36px;
    height: 36px;
    margin-top: -18px;
    margin-left: -18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    border-radius: 50%;
    cursor: pointer;
    z-index: 6;
    transition: color 0.15s ease, transform 0.15s ease;
}

.clock-number.active {
    color: #ffffff;
    font-weight: 700;
}

.clock-number:hover:not(.active) {
    background: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
}

/* Minor tick marks on dial */
.clock-tick {
    position: absolute;
    width: 4px;
    height: 4px;
    margin-top: -2px;
    margin-left: -2px;
    border-radius: 50%;
    background: #cbd5e1;
    pointer-events: none;
}

/* Modal Action Buttons Footer */
.clock-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 18px;
    width: 100%;
    border-top: 1px solid #f1f5f9;
    box-sizing: border-box;
    background: #ffffff;
}

.clock-actions-right {
    display: flex;
    gap: 8px;
}

.clock-action-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clock-action-btn.secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.clock-action-btn.secondary:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.clock-action-btn.primary {
    background: #4f46e5;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.clock-action-btn.primary:hover {
    background: #4338ca;
}
