/* Color Scheme Variables */
:root {
    --bg-background: #121416;
    --bg-surface: #1E2124;
    --bg-button: #2A2E32;
    --bg-outline: #3A3F44;
    --text-primary: #E6E9ED;
    --text-subtext: #A0A5AB;
    --accent: #00E5FF;
    --glow-soft: #00B8D9;
    --glow-strong: #00FFFF;
    --focus-ring: #26F7FF;
    --success: #00C896;
    --warning: #FFD56B;
    --error: #FF4D4D;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-background);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    touch-action: manipulation;
    padding-bottom: env(safe-area-inset-bottom);
}

.app-container {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom);
}

.top-row {
    height: 10vh;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--bg-outline);
}

.weather-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
}

.weather-widget i {
    font-size: 24px;
}

.weather-widget .temp {
    font-size: 18px;
    font-weight: 600;
}

.current-time {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.hexagon-btn {
    width: 50px;
    height: 50px;
    background-color: var(--bg-button);
    border: 2px solid var(--accent);
    color: var(--accent);
    clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    text-decoration: none;
}

.hexagon-btn i {
    font-size: 20px;
}

.hexagon-btn:hover,
.hexagon-btn:active {
    background-color: var(--accent);
    color: var(--bg-background);
    box-shadow: 0 0 20px var(--glow-soft);
}

.quick-launch {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 10px var(--glow-soft);
    }
    50% {
        box-shadow: 0 0 25px var(--glow-strong);
    }
}

.display-section {
    height: 45vh;
    display: flex;
    gap: 15px;
    padding: 15px;
}

.notification-log,
.health-metrics {
    flex: 1;
    background-color: var(--bg-surface);
    border: 1px solid var(--bg-outline);
    border-radius: 12px;
    padding: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notification-log h3,
.health-metrics h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.log-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-content::-webkit-scrollbar {
    width: 6px;
}

.log-content::-webkit-scrollbar-track {
    background: var(--bg-button);
    border-radius: 3px;
}

.log-content::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.log-item {
    background-color: var(--bg-button);
    border-left: 3px solid var(--accent);
    padding: 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.log-item:hover {
    border-left-color: var(--glow-strong);
    box-shadow: 0 2px 8px rgba(0, 229, 255, 0.2);
}

.log-time {
    font-size: 11px;
    color: var(--text-subtext);
    margin-bottom: 4px;
}

.log-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

.chart-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#healthChart {
    max-width: 100%;
    max-height: 200px;
}

.chart-label {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.chart-indicator {
    font-size: 11px;
    color: var(--text-subtext);
    margin-top: 8px;
    font-style: italic;
}

.health-metrics {
    cursor: pointer;
    transition: all 0.3s ease;
}

.health-metrics:active {
    transform: scale(0.98);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

.quick-chat {
    height: 20vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
    gap: 8px;
}

.chat-input-container {
    width: 80%;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background-color: var(--bg-button);
    border: 2px solid var(--bg-outline);
    border-radius: 25px;
    padding: 8px 12px;
}

.chat-input-container.expanded {
    position: fixed;
    top: 15vh;
    bottom: calc(15vh + 20px);
    left: 10%;
    width: 80%;
    z-index: 1000;
    background-color: var(--bg-surface);
    border: 2px solid var(--accent);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.4);
    flex-direction: column;
    align-items: stretch;
}

.chat-header {
    display: none;
}

.chat-input-container.expanded .chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chat-recipient {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
}

.chat-input {
    flex: 1;
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    min-height: 24px;
    max-height: 100px;
    overflow-y: auto;
    padding: 0;
}

.chat-input-container:focus-within {
    border-color: var(--focus-ring);
    box-shadow: 0 0 15px rgba(38, 247, 255, 0.3);
}

.chat-input-container.expanded .chat-input {
    max-height: none;
    height: 100%;
    border: 2px solid var(--bg-outline);
    border-radius: 8px;
    padding: 15px;
    font-size: 16px;
    background-color: var(--bg-button);
}

.send-btn,
.minimize-btn {
    background-color: var(--accent);
    color: var(--bg-background);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-btn:hover,
.send-btn:active,
.minimize-btn:hover,
.minimize-btn:active {
    background-color: var(--glow-strong);
    box-shadow: 0 0 15px var(--glow-soft);
    transform: scale(1.1);
}

.minimize-btn {
    display: none;
}

.chat-input-container.expanded .minimize-btn {
    display: flex;
}

.chat-input-container.expanded .send-btn {
    align-self: flex-end;
    margin-top: 10px;
    width: 48px;
    height: 48px;
}

.last-message {
    width: 80%;
    background-color: var(--bg-surface);
    border: 1px solid var(--bg-outline);
    border-radius: 12px;
    padding: 12px 15px;
}

.message-preview {
    font-size: 13px;
    color: var(--text-subtext);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-preview strong {
    color: var(--accent);
    margin-right: 5px;
}

.hot-links {
    height: 15vh;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
    position: relative;
    z-index: 98;
}

.link-btn {
    width: 60px;
    height: 60px;
}

.link-btn i {
    font-size: 24px;
}

.drawer-handle {
    height: 5vh;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-background);
    border-top: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    cursor: pointer;
    position: sticky;
    top: 0;
    z-index: 101;
    box-shadow: 0 3px 15px rgba(0, 229, 255, 0.3);
    margin: 0;
}

.handle-bar {
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--glow-soft) 0%, var(--accent) 50%, var(--glow-strong) 100%);
    border-radius: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px var(--glow-soft);
}

.drawer-handle::before,
.drawer-handle::after {
    content: "";
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--accent);
    border-radius: 1px;
    transition: all 0.3s ease;
}

.drawer-handle::before {
    box-shadow: 0 6px 0 var(--accent), 0 12px 0 var(--accent);
}

.drawer-handle:active .handle-bar {
    width: 80px;
    height: 5px;
    box-shadow: 0 0 20px var(--glow-strong);
}

.drawer-handle:active {
    background: linear-gradient(180deg, var(--bg-background) 0%, var(--bg-button) 100%);
}

.drawer-handle:active::before,
.drawer-handle:active::after {
    background-color: var(--glow-strong);
}

.app-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background-color: transparent;
    transform: translateY(calc(100% - 12vh));
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99;
    pointer-events: none;
}

.app-drawer.open {
    transform: translateY(10vh);
    z-index: 102;
    pointer-events: auto;
}

.drawer-handle,
.drawer-content {
    pointer-events: auto;
}

.drawer-content {
    height: 95vh;
    background-color: var(--bg-background);
    box-shadow: 0 -5px 30px rgba(0, 229, 255, 0.2);
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    padding: 0px 20px 30px 20px;
    margin-top: 5vh;
}

.drawer-search {
    position: sticky;
    top: 0;
    background-color: var(--bg-background);
    padding: 20px 0 15px 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--bg-outline);
    margin-bottom: 20px;
}

.drawer-search i.fa-search {
    color: var(--text-subtext);
    font-size: 18px;
}

.drawer-search input {
    flex: 1;
    background-color: var(--bg-button);
    border: 2px solid var(--bg-outline);
    border-radius: 20px;
    padding: 10px 15px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.drawer-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}

.drawer-search input::placeholder {
    color: var(--text-subtext);
}

.clear-search {
    background-color: transparent;
    border: none;
    color: var(--text-subtext);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.clear-search:active {
    color: var(--accent);
    transform: scale(1.1);
}

.app-category {
    margin-bottom: 30px;
}

.app-category:first-child {
    margin-top: 60px;
}

.app-category:last-child {
    padding-bottom: 40px;
}

.category-header {
    font-size: 16px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 600;
}

.category-divider {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent) 0%, transparent 100%);
    margin-bottom: 20px;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    justify-items: center;
}

.app-item {
    width: 70px;
    height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
}

.app-item i {
    font-size: 26px;
}

.app-item span {
    font-size: 10px;
    color: var(--text-subtext);
    text-align: center;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-item:hover span {
    color: var(--bg-background);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-button);
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--glow-soft);
}

button:focus,
input:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

@media (max-height: 600px) {
    .hexagon-btn {
        width: 45px;
        height: 45px;
    }
    
    .link-btn {
        width: 50px;
        height: 50px;
    }
    
    .app-item {
        width: 60px;
        height: 60px;
    }
}
