:root {
    --area-width: 80px;
    --sidebar-width: 270px;
    --header-height: 60px;
    --user-height: 60px;
    --bg-dark: #111827;
    --bg-medium: #1f2937;
    --bg-active: #4b535e;
    --text-primary: #ffffff;
    --text-secondary: #999;
    --border-erp: #3498db;
    --border-productivity: #2ecc71;
    --border-management: #e74c3c;
}

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

.app-container {
    position: relative;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.app-header {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    height: var(--header-height);
    width: calc(var(--area-width) + var(--sidebar-width));
    background: var(--bg-dark);
    z-index: 100;
    transition: width 0.3s;
}

.header-logo {
    width: var(--area-width);
    height: 40px;
    object-fit: contain;
    padding: 0 20px;
    cursor: pointer;
}

.header-search {
    flex: 1;
    padding: 6px 10px;
    background: white;
    border: 1px solid #333;
    border-radius: 4px;
}

.header-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    margin: 0 10px;
}

.toggle-icon::before {
    content: '◀';
    font-size: 15px;
}

.app-container.collapsed .header-search {
    display: none;
}

.app-container.collapsed .header-toggle {
    display: none;
}

.app-container.collapsed .app-header {
    width: var(--area-width);
}

.app-container.collapsed .right-panel {
    transform: translateX(-100%);
}

.app-container.collapsed .main-view {
    left: var(--area-width);
}


/* Left Panel - Always visible in desktop */
.left-panel {
    position: absolute;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--area-width);
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.area-icons {
    flex: 1;
    overflow-y: auto;
}

.area-group {
    position: relative;
    border-bottom: 1px solid gray;
}

.area-group::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.area-group.erp::before { background: var(--border-erp); }
.area-group.productivity::before { background: var(--border-productivity); }
.area-group.management::before { background: var(--border-management); }

.area-group.is-hidden,
.area-icon.is-hidden {
    display: none;
}

.area-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.area-icon:hover { background: var(--bg-active); }
.area-icon.active { background: var(--bg-active); }

.area-icon .icon { opacity: 0.6; }

.area-label {
    font-size: 10px;
    color: white;
}

.user-button {
    border-top: 1px solid #333;
    height: var(--user-height);
    display: flex;
    align-items: center;
}

.user-btn {
    width: 100%;
    padding: 15px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
}

.user-btn:hover { background: var(--bg-active); }

/* Right Panel - Collapses in desktop */
.right-panel {
    position: absolute;
    top: var(--header-height);
    left: var(--area-width);
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-medium);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
    z-index: 5;
}

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

.user-info-section {
    height: var(--user-height);
    background: var(--bg-dark);
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 10px;
}

.user-info {
    flex: 1;
    color: var(--text-secondary);
    font-size: 12px;
}

.user-email {
    color: var(--text-primary);
}

.logout-btn, .server-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
}

.logout-btn:hover, .server-btn:hover {
    background: var(--bg-active);
    border-radius: 4px;
}

.server-menu {
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 300px;
    background: #2e384f;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 5px;
    margin-bottom: 5px;
}

.server-menu .menu-item {
    padding: 8px;
    color: white;
    cursor: pointer;
}

.server-list{
    max-height: 60vh;
    overflow: auto;
}

.menu-item.logout{
    border-top: 1px solid grey;
    line-height: 32px;
    margin-top: 15px;
}

.menu-item.logout:hover {
    background: var(--bg-active);
}

.menu-item.logout .icon {
    float: left;
    height: 32px;
    margin-right: 10px;
}

.server-menu input {
    width: 100%;
    padding: 10px;
    margin-bottom: 5px;
    background: white;
    border: 1px solid #333;
    color: black;
    margin-top: 10px;
}

.server-item {
    padding: 8px;
    color: white;
    cursor: pointer;
}

.server-item:hover {
    background: var(--bg-active);
}

/* Main View */
.main-view {
    position: absolute;
    top: 0;
    left: calc(var(--area-width) + var(--sidebar-width));
    right: 0;
    bottom: 0;
    transition: left 0.3s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-view iframe {
    width: 100%;
    height: auto;
    border: none;
    flex: 1;
}

.app-container.nav-locked .left-panel,
.app-container.nav-locked .right-panel {
    pointer-events: none;
    opacity: 0.5;
}

.app-container.nav-locked::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: calc(var(--area-width) + var(--sidebar-width));
    height: 100%;
    background: rgba(215, 0, 0, 0.25);
    pointer-events: none;
    z-index: 20;
}

/* Mobile - Simplified without animations */
@media (max-width: 768px) {
    .app-header {
        width: 100%;
        z-index: 1000;
    }

    .toggle-icon::before {
        content: '☰';
        font-size: 43px;
        margin-top: -13px;
        display: block;
    }

    .app-container .right-panel {
        display: flex;
        z-index: 998;
    }

    .app-container.collapsed .app-header {
        width: 100%;
    }

    .app-container.collapsed .header-search,
    .app-container.collapsed .header-toggle {
        display: block;
    }

    .app-container .left-panel {
        display: flex;
        z-index: 999;
    }

    .app-container.collapsed .left-panel {
        display: none;
    }

    .app-container.collapsed .right-panel {
        display: none;
    }

    /* Main view always full width in mobile */
    .main-view {
        left: 0;
        top: var(--header-height);
    }

    .app-container.collapsed .main-view,
    .app-container .main-view {
        left: 0;
    }
}
