/* ==========================================================================
   ECALC SUITE - Design System & Unified Navigation CSS
   ========================================================================== */

:root {
    --ecalc-cyan: #00D2FF;
    --ecalc-blue: #0066FF;
    --ecalc-amber: #f59e0b;
    --ecalc-emerald: #10b981;
    --ecalc-bg: #030611;
    --ecalc-surface: rgba(11, 18, 33, 0.94);
    --ecalc-border: rgba(0, 210, 255, 0.18);
    --ecalc-text: #f8fafc;
    --ecalc-muted: #94a3b8;
}

/* 1. Global Suite Top Bar */
#ecalc-suite-bar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: clip;
    height: 52px;
    background: rgba(3, 6, 17, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--ecalc-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--ecalc-text);
}

.ecalc-bar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex-shrink: 1;
}

.ecalc-bar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.ecalc-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.ecalc-brand:hover {
    background: rgba(0, 210, 255, 0.1);
}

.ecalc-brand-icon {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #f59e0b, #0066FF, #00D2FF);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.8rem;
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

.ecalc-brand-icon-img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    object-fit: cover;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
    flex-shrink: 0;
}

.ecalc-brand-tag {
    font-size: 0.65rem;
    padding: 1px 5px;
    background: rgba(0, 210, 255, 0.15);
    border: 1px solid rgba(0, 210, 255, 0.35);
    color: var(--ecalc-cyan);
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

/* 9-Dots App Switcher Button */
.ecalc-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
}

.ecalc-btn-icon:hover {
    background: rgba(0, 210, 255, 0.15);
    border-color: var(--ecalc-cyan);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.25);
    transform: translateY(-1px);
}

/* 9-Dots Grid Icon */
.ecalc-grid-icon {
    display: grid;
    grid-template-columns: repeat(3, 4px);
    gap: 3px;
    width: 18px;
    height: 18px;
    place-content: center;
}

.ecalc-grid-icon span {
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 1px;
}

/* Active Project Pill */
.ecalc-project-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 200px;
    flex-shrink: 1;
    min-width: 0;
}

.ecalc-project-pill:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    transform: translateY(-1px);
}

.ecalc-project-pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.ecalc-project-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nav Action Links */
.ecalc-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.ecalc-nav-btn:hover {
    background: rgba(0, 210, 255, 0.12);
    border-color: rgba(0, 210, 255, 0.35);
    color: #ffffff;
}

/* 2. App Switcher Modal (9-Dots Launcher) */
.ecalc-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
    animation: ecalcFadeIn 0.2s ease-out;
}

.ecalc-modal-backdrop.active {
    display: flex;
}

.ecalc-switcher-window {
    width: 95%;
    max-width: 860px;
    max-height: 85vh;
    background: #080d1a;
    border: 1px solid rgba(0, 210, 255, 0.25);
    border-radius: 20px;
    box-shadow: 0 25px 60px -15px rgba(0, 102, 255, 0.4), 0 0 35px rgba(0, 210, 255, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #ffffff;
    font-family: 'Inter', system-ui, sans-serif;
}

.ecalc-switcher-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ecalc-switcher-search {
    position: relative;
    flex: 1;
}

.ecalc-switcher-search input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.4rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 210, 255, 0.2);
    color: #ffffff;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.ecalc-switcher-search input:focus {
    border-color: var(--ecalc-cyan);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
}

.ecalc-switcher-search svg {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--ecalc-cyan);
}

.ecalc-switcher-tabs {
    display: flex;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
}

.ecalc-tab-btn {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.ecalc-tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.ecalc-tab-btn.active {
    background: rgba(0, 210, 255, 0.15);
    border-color: rgba(0, 210, 255, 0.4);
    color: var(--ecalc-cyan);
}

.ecalc-switcher-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}

.ecalc-app-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    text-decoration: none;
    transition: all 0.2s;
}

.ecalc-app-card:hover {
    background: rgba(0, 210, 255, 0.1);
    border-color: rgba(0, 210, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.15);
    color: #ffffff;
}

.ecalc-app-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid rgba(0, 210, 255, 0.2);
    flex-shrink: 0;
}

.ecalc-app-info {
    min-width: 0;
}

.ecalc-app-title {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ecalc-app-cat {
    font-size: 0.7rem;
    color: #94a3b8;
}

/* 3. "Projeto Atual" Slide-over Drawer */
.ecalc-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: none;
}

.ecalc-drawer-backdrop.active {
    display: block;
}

.ecalc-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 440px;
    background: #090e1c;
    border-left: 1px solid rgba(0, 210, 255, 0.25);
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.6);
    z-index: 10002;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    font-family: 'Inter', system-ui, sans-serif;
    color: #ffffff;
}

.ecalc-drawer.active {
    transform: translateX(0);
}

.ecalc-drawer-header {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ecalc-drawer-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ffffff;
    margin: 0;
}

.ecalc-drawer-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ecalc-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ecalc-form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ecalc-form-group input {
    padding: 0.65rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #ffffff;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s;
}

.ecalc-form-group input:focus {
    border-color: var(--ecalc-cyan);
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.2);
    background: rgba(255, 255, 255, 0.07);
}

.ecalc-drawer-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.25);
}

.ecalc-btn-save {
    flex: 1;
    padding: 0.7rem;
    border-radius: 10px;
    background: linear-gradient(135deg, #0066FF, #00D2FF);
    color: #ffffff;
    border: none;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
    transition: all 0.2s;
}

.ecalc-btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 210, 255, 0.45);
}

.ecalc-btn-clear {
    padding: 0.7rem 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ecalc-btn-clear:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Toast */
.ecalc-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 0.8rem 1.4rem;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.95);
    backdrop-filter: blur(10px);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10005;
    animation: ecalcSlideUp 0.3s ease-out;
}

/* Animations */
@keyframes ecalcFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ecalcSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Prevent any app-level headers from sticking or colliding with #ecalc-suite-bar */
body > header,
body header.glass-dark,
body header.glass,
body header.header,
body header.gradient-bg,
header[class*="sticky"] {
    position: relative !important;
    top: auto !important;
}

/* ==========================================================================
   Responsive Mobile Rules for Suite Navigation
   ========================================================================== */
@media (max-width: 768px) {
    #ecalc-suite-bar {
        height: 48px !important;
        padding: 0 10px !important;
        background: #030611 !important;
        border-bottom: 1px solid rgba(0, 210, 255, 0.25) !important;
    }
    .ecalc-bar-left {
        gap: 0.4rem;
    }
    .ecalc-bar-right {
        gap: 0.4rem;
        flex-shrink: 0;
    }
    .ecalc-brand {
        font-size: 0.82rem;
        gap: 0.35rem;
        padding: 0.2rem 0.35rem;
    }
    .ecalc-brand-icon-img {
        width: 24px;
        height: 24px;
    }
    .ecalc-brand-tag {
        font-size: 0.58rem;
        padding: 1px 4px;
    }
    .ecalc-btn-icon {
        width: 32px;
        height: 32px;
    }
    .ecalc-grid-icon {
        width: 15px;
        height: 15px;
        gap: 2.5px;
    }
    .ecalc-grid-icon span {
        width: 3.5px;
        height: 3.5px;
    }
    .ecalc-project-pill,
    .ecalc-nav-cadclone,
    .ecalc-nav-office,
    [data-ecalc-hide-mobile="true"],
    .ecalc-bar-right a.ecalc-nav-btn[href*="cadclone"],
    .ecalc-bar-right a.ecalc-nav-btn[href*="office"] {
        display: none !important;
    }
    .ecalc-nav-btn.ecalc-nav-hub {
        padding: 0.3rem 0.65rem !important;
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        background: rgba(0, 210, 255, 0.12) !important;
        border-color: rgba(0, 210, 255, 0.3) !important;
        color: #00D2FF !important;
        border-radius: 8px !important;
    }
    .ecalc-switcher-window {
        max-width: 95vw;
        max-height: 85vh;
        margin: 0 0.5rem;
        padding: 0;
    }
    .ecalc-switcher-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
    }
}

/* Print Rules: Always hide suite controls on paper / PDF */
@media print {
    #ecalc-suite-bar,
    .ecalc-modal-backdrop,
    .ecalc-drawer-backdrop,
    .ecalc-drawer,
    .ecalc-toast {
        display: none !important;
    }
}

