/* Custom styles for Svitlock WebApp */

:root {
    --tg-theme-bg-color: #1a1a2e;
    --tg-theme-text-color: #ffffff;
    --tg-theme-hint-color: #7c7c7c;
    --tg-theme-link-color: #3390ec;
    --tg-theme-button-color: #3390ec;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-secondary-bg-color: #232323;
}

html {
    overflow-y: scroll;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

/* Navigation active state */
.nav-btn {
    color: var(--tg-theme-hint-color) !important;
    transition: color 0.2s, background 0.2s;
    position: relative;
    border-radius: 12px;
    min-width: 70px;
}

.nav-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: transparent;
    border-radius: 0 0 3px 3px;
    transition: background 0.2s;
}

.nav-btn.active {
    color: var(--tg-theme-button-color) !important;
    background: rgba(51, 144, 236, 0.15);
}

.nav-btn.active::after {
    background: var(--tg-theme-button-color);
}

.nav-btn.active svg {
    stroke: var(--tg-theme-button-color) !important;
}

/* Schedule timeline */
.timeline {
    position: relative;
    height: 40px;
    border-radius: 8px;
    overflow: visible;
}

.timeline-now {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 3px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
    z-index: 10;
}

.timeline-bar {
    position: absolute;
    height: 100%;
    border-radius: 4px;
}

/* Schedule card intervals */
.interval-row {
    position: relative;
    padding-left: 16px;
}

.interval-row.current-interval {
    font-weight: 600;
}

.interval-row.current-interval::before {
    content: '•';
    position: absolute;
    left: 0;
    font-weight: bold;
}

.timeline-on {
    background: linear-gradient(135deg, #10b981, #059669);
}

.timeline-off {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* Status indicators */
.status-on {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.status-off {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.status-unknown {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

/* Toggle switch */
.toggle {
    position: relative;
    width: 52px;
    height: 28px;
    background: #4b5563;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle.active {
    background: var(--tg-theme-button-color);
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle.active::after {
    transform: translateX(24px);
}

/* Cards */
.card {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 12px;
    padding: 16px;
}

/* Pulse animation for live status */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Swipe hint */
.swipe-hint {
    opacity: 0;
    transition: opacity 0.3s;
}

.swipe-hint.show {
    opacity: 1;
}

/* Safe area for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    nav {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .pb-20 {
        padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    }
}

/* Checkbox custom style */
.checkbox-custom {
    appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid var(--tg-theme-hint-color);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.checkbox-custom:checked {
    background: var(--tg-theme-button-color);
    border-color: var(--tg-theme-button-color);
}

.checkbox-custom:checked::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Haptic feedback visual */
.haptic {
    transition: transform 0.1s;
}

.haptic:active {
    transform: scale(0.95);
}

/* Toast notification */
.toast-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 100;
    pointer-events: none;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
