/* ============================================================
   OK-MARKED Kundenportal — portal.css
   Setzt variables.css und fonts.css voraus
   ============================================================ */

/* Verhindert horizontales Scrollen auf allen Geräten */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Box-sizing für alle Portal-Elemente */
.portal-body *,
.portal-body *::before,
.portal-body *::after {
    box-sizing: border-box;
}

/* Layout */
.portal-body {
    display: flex;
    min-height: 100vh;
    background: #f4f5f7;
    font-family: 'Roboto', sans-serif;
    margin: 0;
    overflow-x: hidden;
}

/* ── Sidebar ── */
.portal-sidebar {
    width: 240px;
    min-height: 100vh;
    background: #111;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

.portal-sidebar__logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.portal-sidebar__logo img { display: block; height: 30px; filter: brightness(0) invert(1); }

.portal-sidebar__nav {
    list-style: none;
    margin: 0;
    padding: 12px 0;
    flex: 1;
}

.portal-sidebar__nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: background 0.15s, color 0.15s;
}

.portal-sidebar__nav li a:hover,
.portal-sidebar__nav li a.active {
    background: rgba(57,124,242,0.15);
    color: #397cf2;
}

.portal-sidebar__nav li a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
}

.portal-sidebar__footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.07);
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.portal-sidebar__footer strong {
    color: rgba(255,255,255,0.55);
    font-weight: 500;
    font-size: 13px;
}

.portal-sidebar__footer a {
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.15s;
}

.portal-sidebar__footer a:hover { color: #fff; }

.portal-impersonate-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f59e0b;
    color: #1a1a1a !important;
    font-weight: 600;
    font-size: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.15s;
}

.portal-impersonate-back:hover { background: #fbbf24; color: #1a1a1a !important; }

/* ── Main Content ── */
.portal-main {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
}

.portal-content {
    padding: 48px;
    max-width: 1200px;
    box-sizing: border-box;
    width: 100%;
}

/* ── Page Header ── */
.portal-page-header {
    margin-bottom: 32px;
}

.portal-page-header h1 {
    font-size: 26px;
    font-weight: 500;
    color: #111;
    margin: 0 0 4px;
    line-height: 1.2;
}

.portal-page-header p {
    color: #777;
    margin: 0;
    font-size: 14px;
}

/* ── Cards ── */
.portal-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 24px;
}

.portal-card h2 {
    font-size: 17px;
    font-weight: 500;
    margin: 0 0 20px;
    color: #111;
}

/* ── Module-Kacheln (Dashboard Index) ── */
.portal-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.portal-module-tile {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 28px 24px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.portal-module-tile:hover {
    border-color: #397cf2;
    box-shadow: 0 4px 16px rgba(57,124,242,0.1);
}

.portal-module-tile svg {
    width: 24px;
    height: 24px;
    stroke: #397cf2;
    fill: none;
}

.portal-module-tile__label {
    font-size: 15px;
    font-weight: 500;
    color: #111;
}

/* ── Tabellen (Admin) ── */
.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.portal-table th {
    text-align: left;
    padding: 10px 14px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 500;
    color: #555;
    font-size: 13px;
}

.portal-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #333;
    vertical-align: middle;
}

.portal-table tr:last-child td { border-bottom: none; }
.portal-table tr:hover td { background: #fafbfc; }

/* ── Tags ── */
.portal-tag {
    display: inline-block;
    background: rgba(57,124,242,0.1);
    color: #397cf2;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    margin: 2px;
}

/* ── Formulare ── */
.portal-form-group {
    margin-bottom: 20px;
}

.portal-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

.portal-form-group input[type="text"],
.portal-form-group input[type="email"],
.portal-form-group input[type="password"],
.portal-form-group input[type="url"],
.portal-form-group input[type="file"],
.portal-form-group select,
.portal-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
    color: #111;
}

.portal-form-group input:focus,
.portal-form-group select:focus,
.portal-form-group textarea:focus {
    outline: none;
    border-color: #397cf2;
    box-shadow: 0 0 0 3px rgba(57,124,242,0.12);
}

/* ── Buttons ── */
.portal-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s;
    font-family: 'Roboto', sans-serif;
    line-height: 1;
}

.portal-btn--primary { background: #397cf2; color: #fff; }
.portal-btn--primary:hover { background: #1c5dd0; color: #fff; }

.portal-btn--secondary { background: #f0f2f5; color: #333; }
.portal-btn--secondary:hover { background: #e4e7ec; }

.portal-btn--danger { background: #fee2e2; color: #dc2626; }
.portal-btn--danger:hover { background: #fecaca; }

/* ── Alerts ── */
.portal-alert {
    padding: 13px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.portal-alert--error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.portal-alert--success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

/* ── Login-Seite ── */
.portal-login-page {
    background: #0a0a0a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: 'Roboto', sans-serif;
}

.portal-login-card {
    background: #161616;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 48px;
    width: 100%;
    max-width: 400px;
}

.portal-login-card__logo {
    text-align: center;
    margin-bottom: 32px;
}

.portal-login-card__logo img { filter: brightness(0) invert(1); }

.portal-login-card h1 {
    font-size: 22px;
    font-weight: 500;
    color: #fff;
    margin: 0 0 6px;
    text-align: center;
}

.portal-login-card .portal-subtitle {
    color: rgba(255,255,255,0.45);
    font-size: 14px;
    text-align: center;
    margin: 0 0 32px;
}

.portal-login-card .portal-form-group label {
    color: rgba(255,255,255,0.65);
}

.portal-login-card .portal-form-group input {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.12);
    color: #fff;
}

.portal-login-card .portal-form-group input::placeholder {
    color: rgba(255,255,255,0.25);
}

.portal-login-card .portal-form-group input:focus {
    border-color: #397cf2;
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 0 3px rgba(57,124,242,0.2);
}

.portal-login-card .portal-btn--primary {
    width: 100%;
    justify-content: center;
    padding: 13px;
    margin-top: 8px;
}
.portal-login-back {
    margin-top: 32px;
    text-align: center;
}
.portal-login-back a {
    font-size: 13px;
    color: #fff;
    text-decoration: none;
    transition: opacity .2s;
}
.portal-login-back a:hover {
    opacity: 0.7;
}

/* ── Mobile Header ── */
.portal-mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #111;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    z-index: 200;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.portal-sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.portal-sidebar-close {
    display: none;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}

.portal-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 150;
}

.portal-sidebar-overlay.is-visible {
    display: block;
}

/* ── Globale Mobile-Fixes (alle Dashboards) ── */
@media (max-width: 900px) {
    /* Page-Header mit inline flex:space-between → stapeln */
    .portal-page-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }
    /* Alle portal-cards scrollbar für Tabellen */
    .portal-card { overflow-x: auto !important; }
    /* Period-Buttons umbrechen */
    .seo-period-bar, .gb-period-bar, .u-period-bar, .g-period-bar { flex-wrap: wrap !important; }
    /* Dashboard-spezifische Grids */
    .seo-two-col, .g-two-col { grid-template-columns: 1fr !important; }
    .device-grid { grid-template-columns: 1fr 1fr !important; }
    .gb-kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .gb-section, .gb-section--white { padding: 20px !important; }
    .gb-hero { padding: 24px 20px 20px !important; }
}

@media (max-width: 600px) {
    /* Kleinere Überschriften */
    .portal-page-header h1 { font-size: 20px; }
    /* u-bar-row: Label nimmt volle Breite */
    .u-bar-row { grid-template-columns: 1fr 70px 36px !important; }
    /* u-country-row: letzte Spalte ausblenden */
    .u-country-row { grid-template-columns: 20px 1fr 64px !important; }
    .u-country-row > *:last-child { display: none; }
    /* g-page-row: letzte Spalte enger */
    .g-page-row { grid-template-columns: 1fr 60px !important; }
    .g-page-row > *:last-child { display: none; }
    /* Business: Bar-Label kürzer */
    .gb-bar-label { width: 70px !important; }
    .gb-hero__title { font-size: 18px; }
    .gb-kpi__value { font-size: 26px; }
    /* Reviews: Header stapeln */
    .gb-review__header { flex-direction: column !important; gap: 4px; }
    /* SEO: KW-URL kürzer */
    .kw-url { max-width: 140px !important; }
    /* Tabellen min-width damit sie sauber scrollen */
    .portal-table { min-width: 480px; }
}

@media (max-width: 480px) {
    .gb-kpi__value { font-size: 22px; }
    .portal-module-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Responsive: Tablet (≤ 900px) ── */
@media (max-width: 900px) {
    .portal-mobile-header { display: flex; }

    .portal-sidebar {
        transform: translateX(-260px);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 300;
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }

    .portal-sidebar.is-open { transform: translateX(0); }

    .portal-sidebar-close { display: flex; }

    .portal-main {
        margin-left: 0 !important;
        padding-top: 56px;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden;
    }

    .portal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        padding: 16px !important;
        box-sizing: border-box !important;
    }

    .portal-module-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    /* Tabellen scrollbar machen */
    .portal-card { overflow-x: auto; }
    .portal-table { min-width: 560px; }

    /* KPI-Grids (in den Dashboards) */
    .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .chart-row { flex-direction: column !important; }
}

/* ── Responsive: Smartphone (≤ 600px) ── */
@media (max-width: 600px) {
    .portal-content { padding: 20px 16px; }

    .portal-sidebar { width: 260px; }

    .portal-module-grid { grid-template-columns: repeat(2, 1fr); }

    .kpi-grid { grid-template-columns: 1fr 1fr !important; }
    .kpi-grid .kpi-card { padding: 16px !important; }

    .portal-page-header h1 { font-size: 20px; }

    .portal-card { padding: 18px 16px; }

    /* Buttons untereinander auf sehr kleinen Screens */
    .portal-btn-row { flex-direction: column; gap: 10px; }

    /* Login Card */
    .portal-login-card { padding: 32px 24px; }
}
