/**
 * Hydros OS - Base Variables, Themes, Lock Screen & Home Grid
 */

:root {
    --ios-blue: #007aff;
    --ios-green: #34c759;
    --ios-orange: #ff9500;
    --ios-red: #ff3b30;
    --ios-purple: #af52de;
    --ios-gray-light: #f2f2f7;
    --ios-gray-card-light: #ffffff;
    --ios-text-light: #000000;
    --ios-subtext-light: #8e8e93;

    --ios-gray-dark: #000000;
    --ios-gray-card-dark: #1c1c1e;
    --ios-text-dark: #ffffff;
    --ios-subtext-dark: #8e8e93;

    --app-bg: var(--ios-gray-dark);
    --card-bg: var(--ios-gray-card-dark);
    --text-main: var(--ios-text-dark);
    --text-sub: var(--ios-subtext-dark);
    --border-color: rgba(255, 255, 255, 0.12);

    /* Standard / Default Wallpapers */
    --std-wp-1: radial-gradient(circle at 10% 20%, #302b63 0%, #0f0c29 90%);
    --std-wp-2: linear-gradient(135deg, #0d1b2a, #1b263b, #415a77, #778da9);
    --std-wp-3: radial-gradient(circle at top right, #ff4e50, #f9d423);
    --std-wp-4: linear-gradient(135deg, #0f2027, #203a43, #2c5364);

    /* Liquid Glass Exclusive Wallpapers */
    --glass-wp-1: radial-gradient(circle at 20% 30%, #4facfe 0%, #00f2fe 30%, #4338ca 70%, #0f0c29 100%);
    --glass-wp-2: radial-gradient(circle at 80% 20%, #f72585 0%, #7209b7 40%, #3a0ca3 75%, #03071e 100%);
    --glass-wp-3: radial-gradient(circle at 50% 80%, #ff4e50 0%, #f9d423 50%, #11998e 100%);
    --glass-wp-4: linear-gradient(135deg, #2a0845, #6441a5);

    --active-wallpaper: var(--std-wp-1);

    --screen-brightness: 1;
    --ios-easing: cubic-bezier(0.32, 0.72, 0, 1);

    /* Default (Standard iOS Mode) */
    --glass-border: 1px solid var(--border-color);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --glass-blur: blur(35px);
    --wallpaper-animation: none;
    --wallpaper-size: cover;
}

/* LIQUID GLASS ACTIVE MODE STYLES */
body.liquid-glass-mode {
    --ios-blue: #0a84ff;
    --ios-green: #30d158;
    --ios-orange: #ff9f0a;
    --ios-red: #ff453a;
    --ios-purple: #bf5af2;
    --ios-gray-card-dark: rgba(28, 28, 30, 0.65);
    --card-bg: var(--ios-gray-card-dark);
    --glass-border: 1px solid rgba(255, 255, 255, 0.22);
    --glass-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.18), inset 0 1px 2px 0 rgba(255, 255, 255, 0.4);
    --glass-blur: blur(40px) saturate(190%);
    --wallpaper-animation: liquidFlow 18s ease infinite alternate;
    --wallpaper-size: 200% 200%;
}

body.light-mode.liquid-glass-mode {
    --card-bg: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.6), inset 0 1px 2px 0 rgba(255, 255, 255, 0.9);
    --glass-border: 1px solid rgba(0, 0, 0, 0.12);
}

body.light-mode {
    --app-bg: var(--ios-gray-light);
    --card-bg: var(--ios-gray-card-light);
    --text-main: var(--ios-text-light);
    --text-sub: var(--ios-subtext-light);
    --border-color: rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
}

html,
body {
    position: fixed;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    background-color: #000;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    touch-action: none;
}

#os-viewport {
    position: relative;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    filter: brightness(var(--screen-brightness));
    transition: filter 0.1s linear;
}

.screen-wallpaper {
    position: absolute;
    inset: -20px;
    background: var(--active-wallpaper);
    background-size: var(--wallpaper-size);
    background-position: center;
    background-repeat: no-repeat;
    animation: var(--wallpaper-animation);
    transition: transform 0.4s var(--ios-easing), filter 0.4s ease, background 0.8s ease;
    z-index: 1;
}

@keyframes liquidFlow {
    0% {
        background-position: 0% 20%;
        transform: scale(1);
    }

    50% {
        background-position: 100% 80%;
        transform: scale(1.05) rotate(1deg);
    }

    100% {
        background-position: 30% 90%;
        transform: scale(1.02);
    }
}

.status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: calc(44px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 24px 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    z-index: 9000;
    pointer-events: none;
}

.status-icons {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
}

.battery-icon {
    width: 22px;
    height: 11px;
    border: 1px solid currentColor;
    border-radius: 3px;
    padding: 1px;
    display: flex;
    align-items: center;
    position: relative;
}

.battery-icon::after {
    content: '';
    position: absolute;
    right: -3.5px;
    width: 2px;
    height: 4px;
    background: currentColor;
    border-radius: 0 1px 1px 0;
}

.battery-level {
    width: 80%;
    height: 100%;
    background: currentColor;
    border-radius: 1.5px;
}

.dynamic-island {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 32px;
    background: #000;
    border-radius: 20px;
    z-index: 9001;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: width 0.3s var(--ios-easing), height 0.3s var(--ios-easing), border-radius 0.3s var(--ios-easing), background 0.3s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

body.liquid-glass-mode .dynamic-island {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.dynamic-island.expanded {
    width: 260px;
    height: 60px;
    border-radius: 30px;
    padding: 0 18px;
}

body.liquid-glass-mode .dynamic-island.expanded {
    background: rgba(10, 10, 15, 0.75);
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
}

.island-pill-content {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: space-between;
    pointer-events: none;
}

.home-bar-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(44px + env(safe-area-inset-bottom, 10px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100005 !important;
    pointer-events: none !important;
    touch-action: none;
}

.home-indicator {
    width: 140px;
    height: 6px;
    background-color: #ffffff !important;
    border-radius: 10px;
    opacity: 0.95 !important;
    pointer-events: auto !important;
    cursor: pointer;
    touch-action: manipulation;
    position: relative;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.8), 0 0 4px rgba(0, 0, 0, 0.95);
    transition: transform 0.2s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.2s, background-color 0.3s;
}

body.liquid-glass-mode .home-indicator {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.home-indicator:hover {
    opacity: 1 !important;
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.35), 0 0 5px rgba(0, 0, 0, 0.9);
}

.home-indicator:active {
    transform: scale(0.92, 0.85);
    opacity: 0.5;
}

/* LOCK SCREEN */
.lock-screen {
    position: absolute;
    inset: 0;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding-top: calc(55px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(30px + env(safe-area-inset-bottom, 10px));
    transition: transform 0.5s var(--ios-easing), opacity 0.4s ease;
    touch-action: none;
    cursor: grab;
}

.lock-screen:active {
    cursor: grabbing;
}

.lock-screen.unlocked {
    opacity: 0 !important;
    pointer-events: none !important;
    display: none !important;
}

.lock-top-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    width: 100%;
}


.lock-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    pointer-events: none;
}

.lock-date {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.2px;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.lock-time {
    font-size: 74px;
    font-weight: 200;
    letter-spacing: -2px;
    margin-top: -6px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.swipe-label {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.2px;
    opacity: 0.85;
    animation: bounce 2s infinite ease-in-out;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    margin-bottom: 8px;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    50% {
        transform: translateY(-6px);
        opacity: 1;
    }
}


/* POPUP MODAL DIALOG */
.beta-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 6000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.beta-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.beta-modal-card {
    width: 82%;
    max-width: 320px;
    background: rgba(35, 35, 40, 0.85);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 24px 20px 18px;
    text-align: center;
    color: #fff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    transform: scale(0.9);
    transition: transform 0.25s var(--ios-easing);
}

.beta-modal-overlay.active .beta-modal-card {
    transform: scale(1);
}

.beta-modal-card h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 10px;
}

.beta-modal-card p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.45;
    margin-bottom: 20px;
}

.beta-modal-buttons {
    display: flex;
    gap: 10px;
}

.beta-modal-btn {
    flex: 1;
    background: var(--ios-blue);
    border: none;
    padding: 12px;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.beta-modal-btn:active {
    opacity: 0.75;
}

/* HOME SCREEN */
.home-screen {
    position: absolute;
    inset: 0;
    z-index: 100;
    padding: calc(50px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 10px));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.4s var(--ios-easing), transform 0.4s var(--ios-easing);
    pointer-events: none;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.home-screen::-webkit-scrollbar {
    display: none;
}

.home-screen.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Multi-Page Viewport & Slider */
.home-pages-viewport {
    width: 100%;
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: flex-start;
    touch-action: pan-y;
}

.home-pages-slider {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.home-page {
    min-width: 100%;
    width: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.home-page::-webkit-scrollbar {
    display: none;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    row-gap: clamp(10px, 1.8vh, 18px);
    column-gap: clamp(8px, 1.8vw, 16px);
    justify-items: center;
    width: 100%;
    padding: 4px clamp(12px, 3.5vw, 24px) 12px;
    touch-action: pan-y;
}

/* Page Navigation Arrows */
.home-nav-arrow {
    position: absolute;
    top: 45%;
    transform: translateY(-50%) scale(1);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.38);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    cursor: pointer;
    z-index: 105;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 12px rgba(255, 255, 255, 0.2);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), background 0.2s, box-shadow 0.2s;
    user-select: none;
    -webkit-user-select: none;
}

.home-nav-arrow.left {
    left: 6px;
}

.home-nav-arrow.right {
    right: 6px;
}

.home-nav-arrow:hover {
    background: rgba(255, 255, 255, 0.38);
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 16px rgba(56, 189, 248, 0.5);
}

.home-nav-arrow:active {
    transform: translateY(-50%) scale(0.92);
}

.home-nav-arrow.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.6);
}

@keyframes homeArrowPulse {

    0%,
    100% {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 10px rgba(255, 255, 255, 0.25);
    }

    50% {
        box-shadow: 0 6px 25px rgba(0, 0, 0, 0.45), 0 0 20px rgba(56, 189, 248, 0.6);
    }
}

.home-nav-arrow:not(.hidden) {
    animation: homeArrowPulse 2.8s infinite ease-in-out;
}

/* Page Indicator Dots */
.home-page-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    padding: 4px 0 8px;
    z-index: 102;
    transition: opacity 0.3s ease;
}

.home-page-indicators.hidden {
    display: none;
}

.home-page-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.38);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.home-page-dot.active {
    width: 20px;
    border-radius: 5px;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.app-icon-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.app-icon {
    width: clamp(52px, 7vh, 60px);
    height: clamp(52px, 7vh, 60px);
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(22px, 3vh, 28px);
    color: #fff;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    position: relative;
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.3s;
}

body.liquid-glass-mode .app-icon {
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.app-icon-slot:active .app-icon {
    transform: scale(0.9);
    filter: brightness(0.85);
}

.app-label {
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
    letter-spacing: 0.1px;
}

.dock-outer {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
    border-radius: 35px;
    padding: 12px 18px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    margin-bottom: calc(8px + env(safe-area-inset-bottom, 5px));
    flex-shrink: 0;
    z-index: 10;
    transition: background 0.3s, backdrop-filter 0.3s, border 0.3s;
}

body.liquid-glass-mode .dock-outer {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.dock-outer .app-label {
    display: none;
}

/* APPS VIEW */
.app-window {
    position: absolute;
    inset: 0;
    background-color: var(--app-bg);
    color: var(--text-main);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.45s var(--ios-easing), opacity 0.3s ease, border-radius 0.45s var(--ios-easing);
    overflow: hidden;
    padding-top: calc(44px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 10px));
}

.app-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
    border-radius: 0px;
}

.app-window.closing {
    transform: translateY(100%) scale(0.85);
    opacity: 0;
    border-radius: 40px;
}

.app-nav-bar {
    height: 48px;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: background 0.3s, backdrop-filter 0.3s;
}

body.liquid-glass-mode .app-nav-bar {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(15px);
}

.app-nav-bar h2 {
    font-size: 17px;
    font-weight: 600;
}

.app-nav-bar .nav-btn {
    color: var(--ios-blue);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
}
