/* ─────────────────────────────────────────────
   DPL Planning Suite – Task Pane Styles
   ───────────────────────────────────────────── */

/* ── Variables ── */
:root {
    --primary:        #0078d4;
    --primary-hover:  #106ebe;
    --primary-active: #005a9e;
    --primary-light:  #eff6fc;
    --primary-mid:    #c7e0f4;

    --success:        #107c10;
    --success-bg:     #dff6dd;
    --error:          #a4262c;
    --error-bg:       #fde7e9;
    --info-bg:        #f0f8ff;
    --info-border:    #c7e0f4;

    --bg:             #f3f2f1;
    --surface:        #ffffff;
    --border:         #e1dfdd;
    --text-primary:   #201f1e;
    --text-secondary: #605e5c;
    --text-muted:     #a19f9d;
    --header-bg-1:    #003a70;
    --header-bg-2:    #0078d4;

    --radius-sm: 4px;
    --radius:    6px;
    --radius-lg: 10px;
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.20);
    --transition: 150ms ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ════════════════════════════════════════════
   LOGIN VIEW
════════════════════════════════════════════ */
#view-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--header-bg-1) 0%, var(--primary) 100%);
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px 28px 28px;
    width: 100%;
    max-width: 340px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo-img {
    display: block;
    margin: 0 auto 14px;
    height: 36px;
    width: auto;
    object-fit: contain;
}

.app-subtitle {
    margin: 0;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ════════════════════════════════════════════
   MAIN APP VIEW
════════════════════════════════════════════ */
#view-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── App Header ── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    height: 46px;
    background: linear-gradient(90deg, var(--header-bg-1) 0%, var(--primary) 100%);
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Logo inverted to white for dark header */
.header-logo {
    height: 20px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.92;
}

.brand-divider {
    width: 1px;
    height: 16px;
    background: rgba(255,255,255,0.3);
    flex-shrink: 0;
}

.brand-name {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
}

/* ════════════════════════════════════════════
   APP HEADER – extended for hamburger
════════════════════════════════════════════ */
.header-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-menu {
    font-size: 16px !important;
    padding: 6px 8px;
}

/* ════════════════════════════════════════════
   SIDEBAR BACKDROP
════════════════════════════════════════════ */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 200;
    animation: fadeIn 150ms ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ════════════════════════════════════════════
   SIDEBAR DRAWER
════════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 230px;
    height: 100%;
    background: #1b2a38;
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 4px 0 20px rgba(0,0,0,0.30);
}

.sidebar.is-open {
    transform: translateX(0);
}

/* Sidebar header row */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 16px;
    height: 46px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.45);
}

.btn-ghost-dark {
    color: rgba(255,255,255,0.55) !important;
}
.btn-ghost-dark:hover {
    background: rgba(255,255,255,0.10) !important;
    color: #fff !important;
}

/* Scrollable nav list */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 16px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* ── Nav Group (Demand / Inventory) ── */
.nav-group { margin-top: 4px; }

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 12px 9px 16px;
    border: none;
    background: none;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    transition: color var(--transition), background var(--transition);
}

.nav-group-header:hover {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.05);
}

.nav-group-header.expanded {
    color: rgba(255,255,255,0.80);
}

.nav-group-icon { font-size: 13px; flex-shrink: 0; }

.nav-group-header span { flex: 1; text-align: left; }

.nav-group-chevron {
    font-size: 10px !important;
    transition: transform 200ms ease;
    opacity: 0.6;
}

.nav-group-header.expanded .nav-group-chevron {
    transform: rotate(0deg);
}

.nav-group-header:not(.expanded) .nav-group-chevron {
    transform: rotate(-90deg);
}

/* ── Nav Items (pages) ── */
.nav-group-items {
    list-style: none;
    margin: 0;
    padding: 0 0 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: none;
    border-left: 3px solid transparent;
    background: none;
    font-size: 12.5px;
    font-weight: 400;
    color: rgba(255,255,255,0.60);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    outline: none;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.nav-item .ms-Icon {
    font-size: 12px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.90);
    border-left-color: rgba(255,255,255,0.20);
}

.nav-item:hover .ms-Icon { opacity: 1; }

.nav-item.active {
    background: rgba(0,120,212,0.25);
    color: #fff;
    font-weight: 600;
    border-left-color: var(--primary);
}

.nav-item.active .ms-Icon { opacity: 1; }

/* ── Nav Sub-groups ── */
.nav-subgroup { list-style: none; margin-top: 2px; }

.nav-subgroup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 12px 6px 20px;
    border: none;
    background: none;
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.38);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    transition: color var(--transition), background var(--transition);
}

.nav-subgroup-header:hover {
    color: rgba(255,255,255,0.65);
    background: rgba(255,255,255,0.04);
}

.nav-subgroup-header.expanded { color: rgba(255,255,255,0.52); }

.nav-subgroup-header span { flex: 1; text-align: left; }

.nav-subgroup-icon { font-size: 11px; flex-shrink: 0; }

.nav-subgroup-chevron {
    font-size: 9px !important;
    opacity: 0.5;
    transition: transform 200ms ease;
}

.nav-subgroup-header.expanded .nav-subgroup-chevron { transform: rotate(0deg); }
.nav-subgroup-header:not(.expanded) .nav-subgroup-chevron { transform: rotate(-90deg); }

.nav-subgroup-items {
    list-style: none;
    margin: 0;
    padding: 0 0 2px;
}

.nav-subgroup-items .nav-item { padding-left: 44px; }

/* ── Content Area ── */
.content-area {
    flex: 1;
    overflow-y: auto;
    background: var(--bg);
}

/* ── Panel ── */
.panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-header {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    margin: 0 0 3px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-desc {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ════════════════════════════════════════════
   FORM ELEMENTS
════════════════════════════════════════════ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-optional {
    font-weight: 400;
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 1px 5px;
    border-radius: 10px;
}

.form-input {
    padding: 8px 11px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.12);
}

.form-input::placeholder { color: var(--text-muted); }

/* ── Toggle (Radio) Group ── */
.toggle-group {
    display: flex;
    gap: 8px;
}

.toggle-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface);
    transition: all var(--transition);
    user-select: none;
}

.toggle-option:hover {
    border-color: var(--primary-mid);
    color: var(--primary);
    background: var(--primary-light);
}

.toggle-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-option.is-selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* ════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 3px 10px rgba(0, 120, 212, 0.30);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    background: var(--primary-active);
    transform: translateY(0);
    box-shadow: none;
}

.btn-full { width: 100%; }

.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--primary-light);
    box-shadow: 0 3px 10px rgba(0, 120, 212, 0.15);
    transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
    background: var(--primary-mid);
    transform: translateY(0);
    box-shadow: none;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

.btn-icon-left { font-size: 13px; }

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

/* Ghost button (header) */
.btn-ghost {
    background: none;
    border: none;
    padding: 6px 8px;
    cursor: pointer;
    color: rgba(255,255,255,0.75);
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
    font-size: 15px;
    line-height: 1;
    outline: none;
}

.btn-ghost:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ════════════════════════════════════════════
   ALERTS & STATUS
════════════════════════════════════════════ */
.alert {
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    line-height: 1.5;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border-left: 3px solid var(--error);
}

.status-box {
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    line-height: 1.5;
    background: var(--success-bg);
    color: var(--success);
    border-left: 3px solid var(--success);
}

.status-box.is-error {
    background: var(--error-bg);
    color: var(--error);
    border-left-color: var(--error);
}

/* ── Info Box ── */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.info-box .ms-Icon {
    color: var(--primary);
    font-size: 13px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ════════════════════════════════════════════
   LOADING OVERLAY
════════════════════════════════════════════ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 999;
}

.loading-text {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════
   FILE DROP ZONE (Upload tab)
════════════════════════════════════════════ */
.drop-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 24px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    text-align: center;
}

.drop-zone:hover,
.drop-zone.is-dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* The real <input type="file"> covers the whole zone invisibly */
.drop-zone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.drop-zone-icon {
    font-size: 28px;
    color: var(--primary);
    line-height: 1;
}

.drop-zone-text {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.drop-zone-hint {
    margin: 0;
    font-size: 11px;
    color: var(--text-muted);
}

/* Selected file pill */
.selected-file {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    padding: 7px 10px;
    background: var(--success-bg);
    border: 1px solid var(--success);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--success);
}

.selected-file .ms-Icon { font-size: 14px; flex-shrink: 0; }

.selected-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.btn-clear {
    background: none;
    border: none;
    padding: 0 2px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: var(--success);
    font-weight: 700;
    flex-shrink: 0;
    outline: none;
    transition: color var(--transition);
}

.btn-clear:hover { color: var(--error); }

/* ════════════════════════════════════════════
   SELECT INPUT
════════════════════════════════════════════ */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23605e5c' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}

/* ════════════════════════════════════════════
   ADVANCED / OPTIONAL SECTION (Forecast tab)
════════════════════════════════════════════ */
.section-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 0;
    border: none;
    background: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    outline: none;
    font-family: inherit;
    text-align: left;
    border-top: 1px solid var(--border);
    transition: color var(--transition);
}

.section-toggle:hover { color: var(--primary); }

.section-toggle .ms-Icon {
    font-size: 11px;
    transition: transform var(--transition);
}

.section-toggle.is-open .ms-Icon {
    transform: rotate(90deg);
}

.advanced-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--border);
}

/* ── Two-column form row (side by side fields) ── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

