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

body { 
    font-family: var(--font-main);
    background: var(--color-bg); 
    height: 100vh; 
    color: var(--color-text-primary); 
    overflow: hidden; 
}

.app-container { display: flex; flex-direction: column; min-height: 100vh; }

.section-wrapper {
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    width: 100%;
    border: 1px solid var(--color-border);
    position: relative;
}

header, footer {
    padding: 6px 12px;
    flex-shrink: 0;
    text-align: center; 
    font-weight: 500;
    font-size: 0.875rem;
    background: var(--color-surface);
}

/* 1. LOGO BAR */
.logo-bar {
    height: 6vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid var(--color-border);
    z-index: 70;
    background: var(--color-bg);
}

/* DRAWERS */
.drawer {
    position: absolute; left: 0; width: 100%; background: var(--color-bg);
    border-bottom: 1px solid var(--color-border); max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease; z-index: 60;
}

#dwelSwitcher { top: 44px; }
#notifDrawer { top: 44px; background: var(--color-surface); }
#appsDrawer { top: 90px; z-index: 50; }

#dwelSwitcher.open { max-height: 50vh; overflow-y: auto; }
#notifDrawer.open { max-height: 50vh; overflow-y: auto; }
#appsDrawer.open { max-height: 50vh; overflow-y: auto; }

/* Icon & Row Styling */
#dwelLogo { cursor: pointer; transition: opacity 0.2s; }
#dwelLogo:hover { opacity: 0.7; }
#dwelNotifications { cursor: pointer; padding: 5px; }

.switcher-row { height: 5vh; padding: 0 12px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--color-border-subtle); cursor: pointer; font-size: 0.8rem; }
.notif-row { padding: 10px 15px; border-bottom: 1px solid var(--color-border); font-size: 0.875rem; color: var(--color-text-secondary); }

.icon-nav-container { height: 6vh; display: flex; align-items: center; justify-content: space-around; background: var(--color-bg); z-index: 55; border-bottom: 1px solid var(--color-border); }
.nav-icon-box { color: var(--color-icon-inactive); cursor: pointer; width: 35px; display: flex; justify-content: center; }
.nav-icon-box.active { color: var(--color-icon-active); }

/* --- ICON NAVIGATION STYLES --- */

/* 1. Default (Inactive) State */
.nav-icon-box img, 
#dwelNotifications img {
    width: 22px;
    height: 22px;
    opacity: var(--icon-opacity-inactive);
    filter: grayscale(100%) var(--icon-filter);
    transition: all 0.2s ease;
}

/* 2. Hover State */
.nav-icon-box:hover img, 
#dwelNotifications:hover img {
    opacity: var(--icon-opacity-hover);
    filter: grayscale(0%) var(--icon-filter);
}

/* 3. Active State */
.nav-icon-box.active img {
    opacity: 1;
    filter: grayscale(0%) var(--icon-filter);
    transform: scale(1.1);
}

/* Container styling */
.nav-icon-box {
    cursor: pointer;
    width: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-icon-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.app-icon-box img {
    width: 22px;
    height: 22px;
    opacity: var(--icon-opacity-inactive);
    filter: grayscale(100%) var(--icon-filter);
    transition: all 0.2s ease;
}

.app-icon-box:hover img {
    opacity: var(--icon-opacity-hover);
    filter: grayscale(0%) var(--icon-filter);
}

.app-icon-box.active img {
    opacity: 1;
    filter: grayscale(0%) var(--icon-filter);
    transform: scale(1.1);
}

.app-icon-box.active {
    color: var(--color-text-primary);
    font-weight: 500;
}

#dwelLogo, .mini-logo { width: 30px; height: 30px; border-radius: var(--radius-logo); border: 1px solid var(--color-border); flex-shrink: 0; overflow: hidden; }

.settings-tabs {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-self: flex-start;
}

.settings-tab {
    padding: 12px 16px;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.15s ease;
}

.settings-tab:hover {
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.settings-tab.active {
    color: var(--color-text-primary);
    font-weight: 500;
    background: var(--color-surface);
    border-left: 3px solid var(--color-icon-active);
    padding-left: 13px;
}

.logo-identity {
    display: flex;
    align-items: center;
    gap: 10px;
}

#dwelName {
    font-weight: 600;
}

#localDateTime {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.apps-drawer-row {
    display: flex;
    justify-content: space-around;
    width: 100%;
    align-items: center;
    padding: 8px 0;
}

#dwelLogo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#caretToggle {
    color: var(--color-text-primary);
}

/* SVG replacement sizing */
.icon { width: 22px; height: 22px; }

.content { flex-grow: 1; overflow-y: auto; }

.left-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.right-content {
    flex-grow: 1;
    overflow-y: auto;
}

.panel-themes {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 16px;
}

.theme-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 320px;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.875rem;
    color: var(--color-text-primary);
}

.theme-option:hover {
    background: var(--color-surface);
}

.theme-option.active {
    border-color: var(--color-icon-active);
    font-weight: 500;
}

.theme-preview {
    width: 64px;
    height: 44px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.theme-preview-bar { height: 35%; }
.theme-preview-nav { height: 25%; }
.theme-preview-content { flex-grow: 1; }

.theme-preview-default .theme-preview-bar { background: var(--preview-default-bar); border-bottom: 1px solid var(--preview-default-border); }
.theme-preview-default .theme-preview-nav { background: var(--preview-default-bar); border-bottom: 1px solid var(--preview-default-border); }
.theme-preview-default .theme-preview-content { background: var(--preview-default-surface); }

.theme-preview-dark .theme-preview-bar { background: var(--preview-dark-bar); border-bottom: 1px solid var(--preview-dark-border); }
.theme-preview-dark .theme-preview-nav { background: var(--preview-dark-bar); border-bottom: 1px solid var(--preview-dark-border); }
.theme-preview-dark .theme-preview-content { background: var(--preview-dark-surface); }

/* DESKTOP LAYOUT */
@media (min-width: 768px) and (orientation: landscape) {
    .app-container { flex-direction: row; height: 100vh; overflow: hidden; }
    .sidebar-group { display: flex; flex-direction: column; width: 25%; height: 100vh; flex-shrink: 0; gap: 8px; padding: 8px; }
    .left-section { flex-grow: 1; height: auto; }
    .right-section { flex: 1; height: calc(100vh - 16px); margin: 8px 8px 8px 8px; }
    .resizer { display: block; width: 8px; flex: 0 0 auto; cursor: col-resize; background: var(--color-resizer); border-left: 1px solid var(--color-border); border-right: 1px solid var(--color-border); }
    .logo-bar { height: 5vh; }
    .icon-nav-container { height: 5vh; }
    .icon { width: 22px; height: 22px; }
    #dwelSwitcher { top: 5vh; }
    #notifDrawer { top: 5vh; }
    #appsDrawer { top: 10vh; }
}
