/* APower Flex — Layout (Topbar, Sidebar, Main) */

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: var(--apf-bg-page);
    color: var(--apf-text-primary);
    font-size: 14px;
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ─── Topbar ────────────────────────────────────────────────────── */
.apf-topbar {
    height: 56px;
    background: var(--apf-topbar-bg);
    color: var(--apf-text-on-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.apf-topbar-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

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

.apf-logo-mark {
    width: 30px;
    height: 30px;
    background: var(--apf-primary);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.apf-logo-text {
    font-weight: 500;
    font-size: 15px;
}

.apf-topmenu {
    display: flex;
    gap: 20px;
    font-size: 13px;
}

.apf-topmenu a {
    color: rgba(255, 255, 255, 0.85);
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.apf-topmenu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.apf-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.apf-icon-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.apf-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.apf-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
}

.apf-avatar {
    width: 32px;
    height: 32px;
    background: var(--apf-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.apf-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.apf-user-name { font-size: 13px; font-weight: 500; }
.apf-user-tenant { font-size: 11px; opacity: 0.7; }

/* ─── Layout wrapper ─────────────────────────────────────────────── */
.apf-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

/* ─── Sidebar ────────────────────────────────────────────────────── */
.apf-sidebar {
    width: 240px;
    background: var(--apf-bg-sidebar);
    border-right: 1px solid var(--apf-border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
}

.apf-nav-group {
    margin-bottom: 16px;
}

.apf-nav-label {
    padding: 0 16px 8px;
    font-size: 11px;
    color: var(--apf-text-tertiary);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.apf-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    color: var(--apf-text-primary);
    font-size: 13px;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.apf-nav-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--apf-text-secondary);
    transition: color 0.15s;
}

.apf-nav-item:hover {
    background: var(--apf-bg-hover);
}

.apf-nav-item.is-active {
    background: var(--apf-bg-active);
    border-left-color: var(--apf-primary);
    color: var(--apf-primary);
    font-weight: 500;
}

.apf-nav-item.is-active svg {
    color: var(--apf-primary);
}

/* ─── Sub-Navigation (HR group etc.) ─────────────────────────────── */
.apf-nav-parent {
    position: relative;
    cursor: pointer;
}

.apf-nav-arrow {
    margin-left: auto;
    width: 14px !important;
    height: 14px !important;
    transition: transform 0.2s ease;
    color: var(--apf-text-secondary) !important;
    flex-shrink: 0;
}

.apf-nav-group-expandable.is-open .apf-nav-arrow {
    transform: rotate(90deg);
}

.apf-nav-group-expandable.is-open .apf-nav-parent {
    color: var(--apf-primary);
    font-weight: 500;
}

.apf-nav-group-expandable.is-open .apf-nav-parent svg:not(.apf-nav-arrow) {
    color: var(--apf-primary);
}

.apf-nav-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    background: var(--apf-bg-sidebar);
}

.apf-nav-group-expandable.is-open .apf-nav-sub {
    max-height: 400px;
}

.apf-nav-sub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px 7px 36px;
    color: var(--apf-text-secondary);
    font-size: 12.5px;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
}

.apf-nav-sub-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--apf-text-tertiary);
    transition: color 0.15s;
}

.apf-nav-sub-item:hover {
    background: var(--apf-bg-hover);
    color: var(--apf-text-primary);
}

.apf-nav-sub-item.is-active {
    background: var(--apf-bg-active);
    border-left-color: var(--apf-primary);
    color: var(--apf-primary);
    font-weight: 500;
}

.apf-nav-sub-item.is-active svg {
    color: var(--apf-primary);
}

/* ─── Sidebar footer ──────────────────────────────────────────────── */
.apf-sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--apf-border);
}

.apf-online-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--apf-text-secondary);
}

.apf-online-dot {
    width: 8px;
    height: 8px;
    background: #13A10E;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(19, 161, 14, 0.15);
}

/* ─── Main content area ──────────────────────────────────────────── */
.apf-main {
    flex: 1;
    padding: 24px 32px;
    overflow-x: hidden;
    min-width: 0;
}

.apf-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.apf-greeting {
    font-size: 13px;
    color: var(--apf-text-secondary);
    margin-bottom: 4px;
}

.apf-page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--apf-text-primary);
}

.apf-datetime {
    font-size: 12px;
    color: var(--apf-text-tertiary);
}

/* ─── Generic Card ────────────────────────────────────────────────── */
.apf-card {
    background: var(--apf-bg-card);
    border: 1px solid var(--apf-border);
    border-radius: 8px;
    padding: 20px;
}

.apf-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.apf-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--apf-text-primary);
}

.apf-card-link {
    font-size: 12px;
    color: var(--apf-primary);
    transition: color 0.15s;
}

.apf-card-link:hover {
    color: var(--apf-primary-hover);
    text-decoration: underline;
}

.apf-empty {
    padding: 24px;
    text-align: center;
    color: var(--apf-text-tertiary);
    font-size: 13px;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .apf-sidebar {
        width: 60px;
    }
    .apf-nav-label,
    .apf-online-indicator {
        display: none;
    }
    .apf-nav-item {
        justify-content: center;
        padding: 12px;
        font-size: 0;
    }
    .apf-nav-item svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 768px) {
    .apf-main {
        padding: 16px;
    }
    .apf-topmenu,
    .apf-user-info {
        display: none;
    }
}

/* ─── AConsultIT Update Notification Badge ───────────────────── */
.apf-update-badge {
    display: none;
    align-items: center;
    gap: 6px;
    background: #f59e0b;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    animation: apf-pulse 2s infinite;
    white-space: nowrap;
    margin-right: 4px;
}
.apf-update-badge.apf-visible {
    display: inline-flex;
}
@keyframes apf-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.75; }
}

/* ─── Support-Request Seite ──────────────────────────────────── */
.sr-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.sr-stat-card {
    background: var(--apf-bg-card);
    border: 1px solid var(--apf-border);
    border-radius: 10px;
    padding: 16px 20px;
    text-align: center;
}
.sr-stat-card .sr-stat-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--apf-primary);
}
.sr-stat-card .sr-stat-label {
    font-size: 12px;
    color: var(--apf-text-secondary);
    margin-top: 2px;
}
.sr-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.sr-badge-open     { background: #fef3c7; color: #92400e; }
.sr-badge-progress { background: #dbeafe; color: #1e40af; }
.sr-badge-done     { background: #d1fae5; color: #065f46; }
.sr-badge-urgent   { background: #fee2e2; color: #991b1b; }
.sr-reply-box {
    background: var(--apf-bg-secondary, #f8fafc);
    border: 1px solid var(--apf-border);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}
.sr-reply-box textarea {
    width: 100%; border: none; background: transparent;
    resize: vertical; min-height: 70px;
    font: inherit; color: var(--apf-text-primary);
    outline: none;
}
