/* =========================
   ADMIN LAYOUT
========================= */

.admin-layout {
    min-height: 100vh;
    display: flex;
    background: var(--color-bg-soft);
}

.admin-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    position: relative;
    background: var(--color-bg-soft);
}

/* =========================
   CONTENT AREA
========================= */

.admin-content,
.admin-content-premium {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: var(--footer-height);
    padding: 28px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--color-bg-soft);
}

.admin-content-shell,
.management-page-shell,
.dashboard-page-shell,
.survey-builder-shell,
.questions-page-shell {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
}

.dashboard-page-wrap,
.management-page-wrap,
.survey-builder-page,
.questions-page-wrap {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

/* =========================
   SIDEBAR
========================= */

.admin-sidebar,
.admin-sidebar-premium {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--color-sidebar-start) 0%, var(--color-sidebar-end) 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    z-index: 1000;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.18);
}

.admin-sidebar-top {
    padding: 0;
    overflow: hidden;
}

.admin-sidebar-brand,
.admin-sidebar-logo {
    height: var(--header-height);
    padding: 0;
    margin: 0;
    display: block;
    overflow: hidden;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-sidebar-brand-link,
.admin-sidebar-logo {
    display: block;
    width: 100%;
    height: 100%;
}

.admin-sidebar-logo-plain,
.admin-sidebar-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left center;
}

.admin-sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    margin: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.admin-sidebar-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.admin-sidebar-user-meta {
    min-width: 0;
}

.admin-sidebar-user strong,
.admin-sidebar-user-meta strong {
    display: block;
    font-size: 14px;
    line-height: 1.2;
    margin-bottom: 3px;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-sidebar-user span,
.admin-sidebar-user-meta span {
    display: block;
    font-size: 12px;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px 18px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.admin-sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.admin-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

.admin-sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8fa2bf;
    margin: 12px 6px 8px;
}

.admin-sidebar-link,
.admin-sidebar-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    color: #d9e3f0;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
    font-size: 14px;
    font-weight: 500;
}

.admin-sidebar-link:hover,
.admin-sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(2px);
}

.admin-sidebar-link.is-active {
    background: linear-gradient(135deg, var(--color-primary) 0%, #3b82f6 100%);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 20px rgba(37, 99, 235, 0.22);
}

.admin-sidebar-link-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.admin-sidebar-bottom {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.00) 0%, rgba(255,255,255,0.02) 100%);
}

.admin-sidebar-logout {
    color: #fca5a5;
}

/* =========================
   HEADER
========================= */

.admin-header-premium {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 900;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    gap: 18px;
}

.admin-header-left {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
}

.admin-header-title-wrap {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.admin-header-eyebrow {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-header-topline {
    width: 140px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--color-primary) 0%, #93c5fd 100%);
    margin-bottom: 12px;
}

.admin-header-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.15;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 0 0 auto;
}

.admin-header-userbox {
    text-align: right;
    min-width: 0;
}

.admin-header-userlabel {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 2px;
}

.admin-header-userbox strong {
    display: block;
    font-size: 16px;
    color: #162033;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-header-userbox small {
    display: block;
    font-size: 13px;
    color: #5f728c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-header-logo-card {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 168px;
    max-width: 168px;
    min-height: 54px;
    padding: 8px 12px;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    text-decoration: none;
}

.admin-header-logo-image {
    display: block;
    width: 100%;
    max-width: 144px;
    max-height: 40px;
    object-fit: contain;
    object-position: center;
}

.admin-header-user-badge {
    padding: 10px 14px;
    border-radius: 999px;
    background: #eef4ff;
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 600;
    flex: 0 0 auto;
}

.admin-header-logout,
.admin-header-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-dark-btn) 0%, #1e293b 100%);
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: var(--shadow-sm);
    flex: 0 0 auto;
}

.admin-header-logout:hover,
.admin-header-logout-btn:hover {
    background: linear-gradient(135deg, var(--color-dark-btn-hover) 0%, var(--color-dark-btn) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* =========================
   FOOTER
========================= */

.admin-footer-premium,
.global-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--footer-height);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    font-size: 14px;
    color: var(--color-text-soft);
    z-index: 900;
}

.global-footer-divider {
    color: #cbd5e1;
    margin: 0 8px;
}

.global-footer-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.global-footer-links a {
    color: var(--color-text-soft);
    text-decoration: none;
    transition: color 0.18s ease;
    font-weight: 500;
}

.global-footer-links a:hover {
    color: var(--color-primary);
}

.admin-footer-left,
.admin-footer-right {
    display: flex;
    align-items: center;
}

.admin-footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-soft);
}

.admin-footer-copy {
    font-weight: 600;
    color: #334155;
}

.admin-footer-separator {
    color: #cbd5e1;
}

.admin-footer-note {
    color: #64748b;
    font-size: 13px;
}

.admin-footer-right {
    gap: 18px;
}

.admin-footer-right a {
    color: var(--color-text-soft);
    text-decoration: none;
    transition: color 0.18s ease;
    font-weight: 500;
}

.admin-footer-right a:hover {
    color: var(--color-primary);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1180px) {
    :root {
        --sidebar-width: 250px;
    }

    .admin-header-title {
        font-size: 22px;
    }

    .admin-header-logo-card {
        width: 144px;
        max-width: 144px;
        min-height: 50px;
        padding: 6px 10px;
    }

    .admin-header-logo-image {
        max-width: 122px;
        max-height: 36px;
    }
}

@media (max-width: 980px) {
    .admin-header-logo-card {
        display: none;
    }
}

@media (max-width: 900px) {
    .admin-layout {
        display: block;
    }

    .admin-sidebar,
    .admin-sidebar-premium {
        position: relative;
        width: 100%;
        min-width: 100%;
        height: auto;
    }

    .admin-main {
        margin-left: 0;
        min-height: auto;
        height: auto;
        position: relative;
    }

    .admin-header-premium {
        position: relative;
        left: 0;
        right: auto;
        height: auto;
        padding: 18px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .admin-header-left {
        width: 100%;
    }

    .admin-header-title-wrap {
        width: 100%;
    }

    .admin-header-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .admin-header-logo-card {
        display: inline-flex;
        width: 150px;
        max-width: 150px;
        order: 2;
    }

    .admin-content,
    .admin-content-premium {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        height: auto;
        padding: 20px;
        padding-bottom: 20px;
        overflow: visible;
    }

    .admin-footer-premium,
    .global-footer {
        position: relative;
        left: 0;
        right: auto;
        height: auto;
        padding: 16px 20px;
        box-shadow: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .global-footer-links,
    .admin-footer-right {
        flex-wrap: wrap;
        gap: 14px;
    }

    .admin-footer-left,
    .admin-footer-right {
        width: 100%;
    }

    .admin-footer-brand {
        flex-wrap: wrap;
        gap: 6px;
    }
}

@media (max-width: 640px) {
    .admin-header-right {
        align-items: stretch;
    }

    .admin-header-userbox {
        width: 100%;
        text-align: left;
    }

    .admin-header-logo-card {
        width: 100%;
        max-width: 100%;
        justify-content: flex-start;
    }

    .admin-header-logo-image {
        object-position: left center;
    }

    .admin-header-user-badge {
        align-self: flex-start;
    }

    .admin-header-logout,
    .admin-header-logout-btn {
        width: 100%;
    }
}