/**
 * ProctorEdge Exam Engine - Custom Styles
 *
 * @package pe-exam-engine
 * @version 1.1
 */

:root {
    --pe-primary: #155eef;
    --pe-primary-strong: #063b95;
    --pe-accent: #0f9f7a;
    --pe-danger: #d92d20;
    --pe-warning: #b7791f;
    --pe-ink: #071b4d;
    --pe-muted: #5b6b8a;
    --pe-subtle: #eef4ff;
    --pe-bg: #f6f8fc;
    --pe-panel: #ffffff;
    --pe-border: #dbe3ef;
    --pe-sidebar: #06265c;
    --pe-sidebar-deep: #031a42;
    --pe-shadow: 0 14px 40px rgba(17, 38, 74, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    color: var(--pe-ink);
    background: var(--pe-bg);
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0;
}

a {
    color: var(--pe-primary);
}

.pe-public-navbar {
    background: var(--pe-sidebar);
    box-shadow: 0 2px 16px rgba(3, 26, 66, 0.16);
}

.pe-navbar-brand {
    color: #fff !important;
    font-weight: 700;
}

.pe-public-content {
    padding: 28px 20px;
}

/* =====================================================
   Admin Shell
   ===================================================== */

.pe-admin-shell {
    display: flex;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(21, 94, 239, 0.08), transparent 34rem),
        var(--pe-bg);
}

.pe-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    width: 272px;
    flex-direction: column;
    overflow-y: auto;
    color: #d8e6ff;
    background:
        linear-gradient(180deg, rgba(7, 27, 77, 0.24), rgba(3, 26, 66, 0.96)),
        var(--pe-sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 12px 0 40px rgba(7, 27, 77, 0.16);
}

.pe-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 88px;
    padding: 22px 24px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.pe-brand:hover {
    color: #fff;
}

.pe-brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #2479ff, #0f9f7a);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(21, 94, 239, 0.35);
}

.pe-brand strong,
.pe-brand small {
    display: block;
    line-height: 1.15;
}

.pe-brand strong {
    font-size: 20px;
}

.pe-brand small {
    margin-top: 3px;
    color: #c4d6f7;
    font-size: 13px;
}

.pe-sidebar-nav {
    flex: 1;
    padding: 20px 14px;
}

.pe-nav-section {
    padding: 12px 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.pe-nav-section:last-child {
    border-bottom: 0;
}

.pe-nav-label {
    padding: 0 14px 10px;
    color: #9cb3d9;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pe-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 44px;
    padding: 10px 14px;
    color: #e8f0ff;
    text-decoration: none;
    border-radius: 7px;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.pe-nav-link i {
    width: 22px;
    color: #b8cbef;
    font-size: 19px;
}

.pe-nav-link:hover,
.pe-nav-link.active {
    color: #fff;
    background: rgba(21, 94, 239, 0.82);
}

.pe-nav-link:hover {
    transform: translateX(2px);
}

.pe-nav-link.active::before {
    position: absolute;
    left: -14px;
    width: 3px;
    height: 24px;
    content: "";
    background: #50e3b7;
    border-radius: 999px;
}

.pe-sidebar-footer {
    padding: 16px 14px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.pe-main-panel {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    flex-direction: column;
    margin-left: 272px;
}

.pe-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    min-height: 78px;
    align-items: center;
    gap: 18px;
    padding: 14px 32px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--pe-border);
    backdrop-filter: blur(16px);
}

.pe-breadcrumb-line {
    display: flex;
    min-width: 160px;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    color: var(--pe-muted);
    font-size: 14px;
    white-space: nowrap;
}

.pe-breadcrumb-line a {
    color: #304465;
    text-decoration: none;
}

.pe-breadcrumb-line span {
    color: var(--pe-ink);
    font-weight: 500;
}

.pe-topbar-search {
    display: flex;
    width: min(360px, 32vw);
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--pe-border);
    border-radius: 7px;
    box-shadow: 0 6px 18px rgba(17, 38, 74, 0.05);
}

.pe-topbar-search input {
    width: 100%;
    min-width: 0;
    color: var(--pe-ink);
    background: transparent;
    border: 0;
    outline: 0;
}

.pe-topbar-search kbd {
    color: #52637f;
    background: #f2f5fa;
    border: 1px solid #d7dfeb;
    border-radius: 5px;
    box-shadow: none;
    font-size: 12px;
    white-space: nowrap;
}

.pe-icon-button {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    color: var(--pe-ink);
    background: #fff;
    border: 1px solid var(--pe-border);
    border-radius: 7px;
    text-decoration: none;
}

.pe-user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    color: var(--pe-ink);
    background: transparent;
    border: 0;
}

.pe-user-avatar {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: #fff;
    background: var(--pe-primary);
    border-radius: 50%;
}

.pe-user-menu strong,
.pe-user-menu small {
    display: block;
    text-align: left;
    line-height: 1.2;
}

.pe-user-menu small {
    margin-top: 3px;
    color: var(--pe-muted);
    font-size: 12px;
}

.pe-content {
    flex: 1;
    width: 100%;
    padding: 34px 40px;
}

.pe-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 40px 28px;
    color: var(--pe-muted);
    border-top: 1px solid var(--pe-border);
    font-size: 13px;
}

.pe-footer-divider {
    padding: 0 10px;
    color: #a0aec0;
}

/* =====================================================
   Page & Dashboard Components
   ===================================================== */

.pe-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.pe-page-kicker {
    margin-bottom: 8px;
    color: var(--pe-accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pe-page-title {
    margin: 0;
    color: var(--pe-ink);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 700;
    line-height: 1.1;
}

.pe-page-subtitle {
    max-width: 760px;
    margin: 10px 0 0;
    color: var(--pe-muted);
}

.pe-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pe-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.pe-stat-card,
.pe-panel-card,
.card,
.admin-card {
    background: var(--pe-panel);
    border: 1px solid var(--pe-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(17, 38, 74, 0.05);
}

.pe-stat-card {
    display: flex;
    min-height: 132px;
    align-items: center;
    gap: 16px;
    padding: 22px;
}

.pe-stat-icon,
.pe-tile-icon {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    color: var(--pe-primary-strong);
    background: var(--pe-subtle);
    border: 1px solid #d5e4ff;
    border-radius: 7px;
    font-size: 22px;
}

.pe-stat-label {
    margin-bottom: 4px;
    color: #344767;
    font-size: 14px;
}

.pe-stat-value {
    color: var(--pe-ink);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}

.pe-stat-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    color: var(--pe-muted);
    font-size: 12px;
}

.pe-stat-meta.positive {
    color: var(--pe-accent);
}

.pe-stat-meta.warning {
    color: var(--pe-warning);
}

.pe-dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
}

.pe-workflow-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.workflow-card,
.pe-module-card {
    position: relative;
    display: flex;
    min-height: 132px;
    align-items: center;
    gap: 18px;
    padding: 22px;
    color: var(--pe-ink);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--pe-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(17, 38, 74, 0.05);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.workflow-card:hover,
.pe-module-card:hover {
    color: var(--pe-ink);
    border-color: #a7c4fb;
    box-shadow: var(--pe-shadow);
    transform: translateY(-2px);
}

.workflow-card span,
.pe-module-card strong {
    display: block;
    color: var(--pe-ink);
    font-size: 16px;
    font-weight: 700;
}

.workflow-card small,
.pe-module-card small {
    display: block;
    margin-top: 6px;
    color: var(--pe-muted);
    line-height: 1.55;
}

.workflow-card::after,
.pe-module-card::after {
    position: absolute;
    right: 18px;
    bottom: 16px;
    color: #26456f;
    content: "\F138";
    font-family: "bootstrap-icons";
    font-size: 20px;
}

.workflow-card i {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    color: var(--pe-primary-strong);
    background: var(--pe-subtle);
    border: 1px solid #d5e4ff;
    border-radius: 7px;
    font-size: 22px;
}

.pe-order-panel {
    position: sticky;
    top: 104px;
    padding: 22px;
}

.pe-order-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--pe-border);
    font-weight: 700;
}

.pe-timeline {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pe-timeline li {
    position: relative;
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
    padding: 0 0 22px;
}

.pe-timeline li:last-child {
    padding-bottom: 0;
}

.pe-timeline li::before {
    position: absolute;
    top: 34px;
    bottom: 4px;
    left: 16px;
    width: 1px;
    content: "";
    background: #c8d5e8;
}

.pe-timeline li:last-child::before {
    display: none;
}

.pe-step-number {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    color: #fff;
    background: var(--pe-primary);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
}

.pe-timeline strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.pe-timeline span {
    color: var(--pe-muted);
    font-size: 13px;
    line-height: 1.45;
}

.pe-status-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.workflow-field {
    display: flex;
    min-height: 76px;
    align-items: center;
    gap: 13px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--pe-border);
    border-radius: 8px;
}

.workflow-field i {
    color: var(--pe-accent);
    font-size: 22px;
}

.workflow-field strong {
    display: block;
    color: var(--pe-ink);
    font-size: 22px;
}

.workflow-field span {
    color: var(--pe-muted);
    font-size: 13px;
}

.event-chip {
    padding: 12px 14px;
    text-align: center;
    color: var(--pe-primary-strong);
    background: var(--pe-subtle);
    border: 1px solid #cfe0ff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.table {
    --bs-table-color: var(--pe-ink);
    --bs-table-hover-bg: #f5f8ff;
}

.table thead th {
    color: #53647f;
    border-bottom-color: var(--pe-border);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.card {
    overflow: hidden;
}

.card-header,
.card-body {
    border-color: var(--pe-border);
}

.btn {
    border-radius: 7px;
    font-weight: 600;
}

.btn-primary {
    background: var(--pe-primary);
    border-color: var(--pe-primary);
}

.badge {
    border-radius: 999px;
    font-weight: 600;
}

/* =====================================================
   Candidate Exam Runtime Styles
   ===================================================== */

.question-container {
    padding: 24px;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid var(--pe-border);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--pe-border);
}

.question-number {
    color: var(--pe-primary-strong);
    font-size: 18px;
    font-weight: 700;
}

.question-points {
    padding: 4px 12px;
    color: #fff;
    background: var(--pe-accent);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.question-text {
    margin-bottom: 20px;
    color: #1f2937;
    font-size: 16px;
    line-height: 1.6;
}

.question-media {
    margin: 20px 0;
    text-align: center;
}

.question-media img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.question-options {
    padding: 0;
    margin: 0;
    list-style: none;
}

.question-option {
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    background: #f8f9fa;
    border: 2px solid var(--pe-border);
    border-radius: 6px;
    transition: all 0.2s;
}

.question-option:hover {
    background: #eef4ff;
    border-color: var(--pe-primary);
}

.question-option.selected {
    color: #fff;
    background: var(--pe-primary);
    border-color: var(--pe-primary);
}

.question-option input[type="radio"],
.question-option input[type="checkbox"] {
    margin-right: 10px;
}

.exam-timer {
    position: fixed;
    top: 88px;
    right: 20px;
    z-index: 1000;
    padding: 12px 20px;
    color: #fff;
    background: var(--pe-primary-strong);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 18px;
    font-weight: 700;
}

.exam-timer.warning {
    background: #f59f00;
    animation: pulse 1s infinite;
}

.exam-timer.danger {
    background: var(--pe-danger);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.question-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 20px;
    margin-top: 30px;
    border-top: 2px solid var(--pe-border);
}

.question-nav-buttons {
    display: flex;
    gap: 10px;
}

.question-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
}

.question-list-item {
    display: flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--pe-border);
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.2s;
}

.question-list-item:hover {
    background: #eef4ff;
    border-color: var(--pe-primary);
}

.question-list-item.answered {
    color: #fff;
    background: var(--pe-accent);
    border-color: var(--pe-accent);
}

.question-list-item.current {
    color: #fff;
    background: var(--pe-primary);
    border-color: var(--pe-primary);
}

.question-list-item.flagged {
    background: #fff7e6;
    border-color: #f59f00;
}

.text-pe-primary {
    color: var(--pe-primary) !important;
}

.bg-pe-primary {
    background-color: var(--pe-primary) !important;
}

.bg-pe-secondary {
    background-color: var(--pe-accent) !important;
}

.border-pe-primary {
    border-color: var(--pe-primary) !important;
}

/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 1199px) {
    .pe-stat-grid,
    .pe-status-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pe-dashboard-layout {
        grid-template-columns: 1fr;
    }

    .pe-order-panel {
        position: static;
    }

    .pe-workflow-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .pe-sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

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

    .pe-main-panel {
        margin-left: 0;
    }

    .pe-topbar {
        padding: 12px 18px;
    }

    .pe-breadcrumb-line {
        display: none;
    }

    .pe-topbar-search {
        width: 100%;
    }

    .pe-user-menu span:not(.pe-user-avatar),
    .pe-user-menu > i {
        display: none;
    }

    .pe-content {
        padding: 24px 18px;
    }

    .pe-footer {
        flex-direction: column;
        padding: 18px;
    }
}

@media (max-width: 767px) {
    .pe-page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .pe-stat-grid,
    .pe-status-strip,
    .pe-workflow-grid {
        grid-template-columns: 1fr;
    }

    .pe-stat-card,
    .workflow-card,
    .pe-module-card {
        min-height: 112px;
    }

    .exam-timer {
        position: relative;
        top: 0;
        right: 0;
        margin-bottom: 20px;
    }

    .question-nav {
        flex-direction: column;
        gap: 15px;
    }

    .question-list {
        justify-content: center;
    }
}
