/* Общие стили для приложения Часы */
.clock-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background-color: #000;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
    touch-action: manipulation;
    user-select: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

/* Табы навигации */
.clock-tabs {
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding-top: calc(env(safe-area-inset-top, 0) + 10px);
    z-index: 101;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.5;
    transition: opacity 0.3s;
    cursor: pointer;
}

.tab-item.active {
    opacity: 1;
}

.tab-icon {
    margin-bottom: 5px;
    filter: invert(67%) sepia(6%) saturate(278%) hue-rotate(201deg) brightness(91%) contrast(87%);
}

.tab-icon svg {
    width: 28px;
    height: 28px;
}

.tab-item span {
    font-size: 10px;
    font-weight: 400;
}

/* Контент вкладок */
.tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 0 0 70px;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.tab-content.active {
    display: flex;
}

/* Контент секундомера */
#stopwatch {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 0 0 70px;
}

#stopwatch.active {
    display: flex;
}

.stopwatch-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    position: relative;
    height: 100%;
    box-sizing: border-box;
}

.stopwatch-display {
    font-size: 86px;
    font-family: -apple-system, system-ui;
    font-variant-numeric: tabular-nums;
    margin: 100px 0 50px;
    flex-shrink: 0;
    font-weight: 200;
    letter-spacing: 1px;
}

.stopwatch-circles {
    display: flex;
    gap: 8px;
    margin-bottom: 40px;
    flex-shrink: 0;
}

.circle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #333;
}

.circle.active {
    background-color: #fff;
}

.stopwatch-controls {
    display: flex;
    gap: 170px;
    margin-bottom: 40px;
    flex-shrink: 0;
}

.stopwatch-button {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    border: none;
    font-size: 17px;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lap-button {
    background-color: rgba(128, 128, 128, 0.2);
    color: #fff;
}

.lap-button:not(:disabled):hover {
    background-color: rgba(128, 128, 128, 0.3);
}

.lap-button:disabled {
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

.start-button {
    background-color: rgba(40, 200, 40, 0.2);
    color: #30d158;
}

.start-button:hover {
    background-color: rgba(40, 200, 40, 0.3);
}

.start-button.active {
    background-color: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}

.start-button.active:hover {
    background-color: rgba(255, 59, 48, 0.3);
}

.laps {
    width: 100%;
    height: 250px;
    overflow-y: auto;
    padding: 0 20px;
    margin-bottom: 80px;
    flex-shrink: 0;
}

.lap-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-variant-numeric: tabular-nums;
    font-size: 16px;
}

.lap-item.fastest {
    color: #30d158;
}

.lap-item.slowest {
    color: #ff453a;
}

.clock-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background-color: rgba(28, 28, 30, 0.8);
    backdrop-filter: blur(10px);
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1001;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #98989f;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 5px 0;
}

.nav-item svg {
    width: 28px;
    height: 28px;
    margin-bottom: 5px;
}

.nav-item.active {
    opacity: 1;
    color: #ff9500;
}

.nav-item span {
    font-size: 12px;
    font-weight: 400;
    color: #98989f;
}

.nav-item.active span {
    color: #ff9500;
}

.swipe-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, 
        rgba(255,255,255,0.05) 0%,
        rgba(255,255,255,0.02) 50%,
        transparent 100%);
    border-radius: 20px 20px 0 0;
    z-index: 1000;
    margin-bottom: calc(env(safe-area-inset-bottom) + 50px);
}

/* Круги */
.lap-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dot-indicator {
    display: flex;
    justify-content: center;
    padding: 5px 0;
}

.dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #666;
    margin: 0 2px;
}

.dot.active {
    background-color: #fff;
}

/* Полноэкранный режим */
.app-container.open {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background: #000;
}

.app-container.open .app-header,
.app-container.open .springboard-container {
    display: none;
}

.app-container.open .clock-app {
    padding-top: env(safe-area-inset-top, 0);
}

/* Адаптивность */
@media screen and (max-width: 380px) {
    .stopwatch-time {
        font-size: 60px;
    }
    
    .control-button {
        width: 70px;
        height: 70px;
        font-size: 16px;
    }
}

@media screen and (max-height: 700px) {
    .stopwatch-display {
        height: 25%;
        padding-top: 20px;
    }
    
    .stopwatch-time {
        font-size: 50px;
    }
    
    .stopwatch-controls {
        padding: 20px;
    }
    
    .control-button {
        width: 60px;
        height: 60px;
    }
}

/* Стили перенесены в world-clock */

.world-clock-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    height: 100%;
    box-sizing: border-box;
}

.word-clock-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.button-row {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.word-clock-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(40, 40, 40, 0.5);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: rgba(150, 150, 150, 0.7);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.word-clock-button:hover {
    background-color: rgba(60, 60, 60, 0.6);
}

.word-clock-button:active, .word-clock-button.clicked {
    background-color: rgba(200, 200, 200, 0.7);
    transform: scale(0.95);
    animation: button-clicked 0.5s ease;
}

@keyframes button-clicked {
    0% {
        background-color: rgba(200, 200, 200, 0.7);
        transform: scale(0.95);
    }
    50% {
        background-color: rgba(220, 220, 220, 0.8);
        transform: scale(0.98);
    }
    100% {
        background-color: rgba(200, 200, 200, 0.7);
        transform: scale(0.95);
    }
}

.lock-screen-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: none; /* Скрыто по умолчанию */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(0, 0, 0, 1) 0%, rgba(45, 7, 97, 1) 40%, rgba(30, 5, 70, 1) 100%);
    z-index: 999999 !important; /* Максимально высокий z-index */
    overflow: hidden;
    min-height: 100vh;
    min-width: 100vw;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
    width: 100vw !important;
    height: 100vh !important;
}

.lock-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    padding: 50px 20px;
    box-sizing: border-box;
}

.lock-screen-time {
    text-align: center;
    margin-top: 100px;
}

.time-display {
    font-size: 86px;
    font-weight: 200;
    margin-bottom: 10px;
    color: white;
}

.date-display {
    font-size: 22px;
    color: rgba(255, 255, 255, 0.9);
}

.lock-screen-controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 20px;
    margin-bottom: 50px;
}

.control-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dot-indicator {
    display: flex;
    gap: 8px;
    margin-top: 100px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
}

.dot.active {
    background-color: #fff;
}

.app-container.open {
    transform: translateY(0);
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 10000;
}

.app-container.open .app-header,
.app-container.open .app-content {
    opacity: 1;
    transition: opacity 0.3s ease 0.2s;
}

.app-container.open .clock-app {
    transform: translateY(0);
    opacity: 1;
}

@media screen and (max-width: 380px) {
    .stopwatch-time {
        font-size: 60px;
    }
    
    .control-button {
        width: 45px;
        height: 45px;
    }
    
    .word-clock-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media screen and (max-height: 700px) {
    .stopwatch-display {
        margin: 60px 0 30px;
    }
    
    .stopwatch-time {
        font-size: 60px;
    }
    
    .stopwatch-controls {
        gap: 120px;
    }
    
    .control-button {
        width: 45px;
        height: 45px;
    }
    
    .time-display {
        font-size: 70px;
    }
    
    .lock-screen-time {
        margin-top: 60px;
    }
}

/* Контент мировых часов */
#world-clock {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 0 0 70px;
    background-color: #000;
}

#world-clock.active {
    display: flex;
}

.world-clock-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Контент будильника */
#alarms {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 0 0 70px;
    background-color: #000;
}

#alarms.active {
    display: flex;
}

.alarms-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Контент таймера */
#timers {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 0 0 70px;
    background-color: #000;
}

#timers.active {
    display: flex;
}

.timers-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Global lock screen container styles */
#global-lock-screen-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999999 !important; /* Максимально высокий z-index */
    pointer-events: auto;
    display: none; /* Скрыто по умолчанию */
    transform: translateZ(0) !important;
    will-change: transform !important;
    isolation: isolate !important;
    opacity: 1 !important;
    visibility: visible !important;
    background-color: rgba(0, 0, 0, 0.5) !important; /* Полупрозрачный фон */
}

#global-lock-screen-container.force-visible,
#global-lock-screen-container.visible {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 9999999 !important;
    pointer-events: auto !important;
}

#force-lock-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: linear-gradient(180deg, rgba(0, 0, 0, 1) 0%, rgba(45, 7, 97, 1) 40%, rgba(30, 5, 70, 1) 100%) !important;
    z-index: 9999999 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    isolation: isolate !important;
    pointer-events: auto !important;
}

#fallback-lock-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: linear-gradient(180deg, rgba(0, 0, 0, 1) 0%, rgba(45, 7, 97, 1) 40%, rgba(30, 5, 70, 1) 100%) !important;
    z-index: 9999999 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    isolation: isolate !important;
    pointer-events: auto !important;
}

/* Стили для отображения времени на экране блокировки */
#countdown-time, #fallback-countdown-time {
    font-size: 96px !important;
    font-weight: 200 !important;
    color: white !important;
    text-align: center !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    letter-spacing: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    width: 100% !important;
    line-height: 1.2 !important;
} 