/* ========== BASE ========== */
body { margin: 0; background: #f8f9fb; overflow-x: hidden; }
img, table { max-width: 100%; }
.app-wrapper { display: flex; min-height: 100vh; }

/* ========== SIDEBAR ========== */
.sidebar { width: 225px; min-width: 225px; background: linear-gradient(180deg, #052b61, #031b40); color: white; display: flex; flex-direction: column;position:fixed;z-index:1000;height:100vh; }
.logo-area { padding: 14px 20px 10px 20px; border-bottom: 1px solid rgba(255,255,255,.1); background-color: white; color: #05295c; }
.logo-placeholder { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.logo-img { max-width: 136px; height: auto; display: block; }
.sidebar-menu { padding: 16px; flex: 1; overflow-y: auto; min-height: 0; }
.sidebar-menu::-webkit-scrollbar { width: 6px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.sidebar-menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.35); }
.sidebar-menu ul { list-style: none; padding: 0; margin: 0; }
.sidebar-menu li { margin-bottom: 4px; }
.sidebar-menu a { color: rgba(255,255,255,.8); text-decoration: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: 13px; border-radius: 8px; transition: all .25s ease; }
.sidebar-menu a:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(4px); }
.sidebar-menu a.active { background: #2f6fff; color: #fff; font-weight: 500; box-shadow: 0 4px 12px rgba(47,111,255,.3); }
.badge-count { background: #ef4444; color: white; border-radius: 10px; padding: 1px 7px; font-size: 10px; margin-left: auto; }
.upload-btn { width: 100%; height: 42px; font-size: 13px; font-weight: 500; background: #2f6fff; color: white; border: none; padding: 12px; border-radius: 8px; margin-bottom: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.upload-btn:hover { background: #1a56e8; }
.sidebar-file-item { font-size: 11px; color: rgba(255,255,255,.6); padding: 4px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.support-box { margin: auto 15px 15px; border: 1px solid rgba(255,255,255,.15); border-radius: 10px; padding: 15px; }
.support-box h6 { color: white; margin: 0 0 4px; }
.support-box p { color: rgba(255,255,255,.6); margin: 0 0 10px; }
.support-box button { width: 100%; background: none; border: 1px solid rgba(255,255,255,.4); color: white; border-radius: 8px; padding: 8px; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.support-box button:hover { background: rgba(255,255,255,.08); }

/* ========== MAIN CONTENT ========== */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0;margin-left:225px; }
.top-header {
    height: 70px;
    background: linear-gradient(180deg, #052b61, #031b40);
    
    border-bottom: 1px solid #e8edf5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-right { display: flex; gap: 18px; font-size: 13px; align-items: center; }
.header-right a { color: #fff; text-decoration: none; }
.help-link { display: flex; align-items: center; gap: 6px; padding-right: 18px; border-right: 1px solid #dbe2ea; color: #374151; }
.user-dropdown { display: flex; align-items: center; gap: 4px; cursor: pointer; font-size: 13px;color:white; }
.user-dropdown i { padding: 4px; }

/* ========== PAGE HEADER ========== */
.page-header { padding: 22px 24px 12px; }
.page-header h2 { font-weight: 700; font-size: 24px; margin-bottom: 6px; color: #05295c; }
.page-header p { font-size: 13px; color: #6b7280; margin-bottom: 0; }

/* ========== WIZARD STEPS ========== */
.wizard { display: flex; gap: 0; padding: 0 24px; border-top: 1px solid #e8edf5; border-bottom: 1px solid #e8edf5; background: white; overflow-x: auto; }
.step { display: flex; gap: 10px; align-items: center; padding: 14px 20px 14px 0; cursor: pointer; position: relative; }
.step:not(:last-child)::after { content: '›'; position: absolute; right: 4px; color: #d1d5db; font-size: 16px; }
.step span { width: 28px; height: 28px; font-size: 12px; font-weight: 600; border-radius: 50%; background: #e5e7eb; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step.active span { background: #2f6fff; color: white; }
.step.completed span { background: #10b981; color: white; }
.step.active h6 { color: #2f6fff; }
.step.completed h6 { color: #10b981; }
.step h6 { font-size: 12px; font-weight: 600; margin: 0; color: #374151; }
.step small { font-size: 10px; color: #6b7280; }

/* ========== CARDS ========== */
.card { border: 1px solid #e5e7eb; border-radius: 10px; box-shadow: none; padding: 24px; background: white; }
.form-card { padding: 24px; }
.form-card h5 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: #042658; }
.form-card > p { font-size: 12px; color: #6b7280; margin-bottom: 18px; }
.card > h6 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: #042658; }
.card > p { font-size: 12px; color: #6b7280; margin-bottom: 14px; }
.upload-card { padding: 18px; }

/* ========== FORM ELEMENTS ========== */
label { font-size: 12px; font-weight: 500; margin-bottom: 6px; color: #042658; display: block; }
.form-control, .form-select { height: 40px; font-size: 13px; border-radius: 6px; border: 1px solid #d7dde8; }
.form-control:focus, .form-select:focus { border-color: #2f6fff; box-shadow: 0 0 0 3px rgba(47,111,255,.1); outline: none; }
textarea.form-control { height: auto !important; padding-top: 10px; resize: vertical; }
.form-control::placeholder { color: #9ca3af; font-size: 12px; }
.astreik { color: #de3730; }

/* ========== UPLOAD BOX ========== */
.upload-box { border: 2px dashed #d5dce7; border-radius: 10px; text-align: center; padding: 30px 16px; transition: all .2s; }
.upload-box:hover, .upload-box.dragover { border-color: #2f6fff; background: #f0f5ff; }
.upload-box i { font-size: 32px; color: #2f6fff; }
.upload-box h6 { font-size: 13px; margin: 10px 0 8px; }
.upload-box small { display: block; font-size: 11px; color: #6b7280; margin-top: 10px; }
.file-item { display: flex; align-items: center; justify-content: space-between; background: #f8f9fb; border: 1px solid #e5e7eb; border-radius: 6px; padding: 6px 10px; margin-top: 8px; font-size: 12px; }
.file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-size { color: #6b7280; margin: 0 8px; white-space: nowrap; }
.file-item .remove-file { color: #ef4444; cursor: pointer; background: none; border: none; padding: 0 2px; font-size: 14px; }

/* ========== GUIDELINES / CERT TAGS ========== */
.guide-list { padding-left: 0; list-style: none; margin: 0; }
.guide-list li { position: relative; padding-left: 18px; margin-bottom: 8px; font-size: 12px; color: #374151; }
.guide-list li::before { content: ""; width: 6px; height: 6px; background: #2563eb; border-radius: 50%; position: absolute; left: 0; top: 6px; }
.cert-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.cert-tags span { background: #f3f4f6; border: 1px solid #e5e7eb; padding: 4px 10px; border-radius: 20px; font-size: 11px; }

/* ========== BUTTONS ========== */
.btn-primary { background: #2f6fff; border-color: #2f6fff; height: 38px; font-size: 13px; font-weight: 500; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary:hover { background: #1a56e8; border-color: #1a56e8; }
.btn-outline-primary { border-color: #2f6fff; color: #2f6fff; font-size: 13px; }
.btn-outline-primary:hover { background: #2f6fff; color: white; }
.btn-secondary { height: 38px; font-size: 13px; border-radius: 6px; }
.row.g-3 { padding: 0 24px; }

/* ========== DASHBOARD STATS ========== */
.stat-card { border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; background: white; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-icon.blue { background: #eff6ff; color: #2f6fff; }
.stat-icon.green { background: #f0fdf4; color: #10b981; }
.stat-icon.orange { background: #fff7ed; color: #f97316; }
.stat-icon.purple { background: #faf5ff; color: #8b5cf6; }
.stat-info h3 { font-size: 22px; font-weight: 700; color: #05295c; margin: 0; }
.stat-info p { font-size: 12px; color: #6b7280; margin: 0; }

/* ========== TABLES ========== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 10px 14px; font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid #e5e7eb; background: #f9fafb; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; color: #374151; }
.data-table tbody tr:hover { background: #f9fafb; }
.status-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.status-badge.published, .status-badge.active { background: #f0fdf4; color: #10b981; }
.status-badge.draft { background: #f3f4f6; color: #6b7280; }
.status-badge.pending { background: #fff7ed; color: #f97316; }
.status-badge.review { background: #eff6ff; color: #2f6fff; }
.status-badge.rejected { background: #fef2f2; color: #ef4444; }
.status-badge.completed, .status-badge.approved { background: #f0fdf4; color: #10b981; }
.status-badge.unread { background: #eff6ff; color: #2f6fff; }
.status-badge.read { background: #f3f4f6; color: #6b7280; }

/* ========== MESSAGE ITEMS ========== */
.message-item { border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 16px; margin-bottom: 8px; cursor: pointer; transition: all .2s; }
.message-item:hover { border-color: #2f6fff; background: #f8fbff; }
.message-item.unread { border-left: 3px solid #2f6fff; }
.message-item .msg-sender { font-weight: 600; font-size: 13px; color: #05295c; }
.message-item .msg-subject { font-size: 12px; color: #374151; margin: 2px 0; }
.message-item .msg-preview { font-size: 11px; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-item .msg-date { font-size: 11px; color: #9ca3af; white-space: nowrap; }

/* ========== CERTIFICATION CARDS ========== */
.cert-card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 20px; background: white; }
.cert-card .cert-authority { font-size: 20px; font-weight: 700; color: #05295c; margin-bottom: 4px; }
.cert-card .cert-name { font-size: 12px; color: #6b7280; }
.cert-card .cert-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 20px; margin-top: 12px; }
.cert-card .cert-status.valid { background: #f0fdf4; color: #10b981; }
.cert-card .cert-status.expiring { background: #fff7ed; color: #f97316; }
.cert-card .cert-status.expired { background: #fef2f2; color: #ef4444; }
.cert-card .cert-status.not-held { background: #f3f4f6; color: #9ca3af; }

/* ========== SETTINGS TABS ========== */
.settings-tab { display: flex; border-bottom: 2px solid #e5e7eb; margin-bottom: 24px; gap: 4px; }
.settings-tab a { padding: 10px 18px; font-size: 13px; color: #6b7280; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.settings-tab a.active { color: #2f6fff; border-bottom-color: #2f6fff; font-weight: 500; }
.settings-tab a:hover { color: #374151; }

/* ========== ALERTS ========== */
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; border-radius: 8px; padding: 12px 16px; font-size: 13px; }
.alert-danger { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; border-radius: 8px; padding: 12px 16px; font-size: 13px; }
.alert-info { background: #eff6ff; border: 1px solid #93c5fd; color: #1e40af; border-radius: 8px; padding: 12px 16px; font-size: 13px; }

/* ========== EMPTY STATE ========== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 48px; color: #d1d5db; margin-bottom: 16px; }
.empty-state h5 { font-size: 16px; color: #374151; margin-bottom: 8px; }
.empty-state p { font-size: 13px; color: #9ca3af; }

/* ========== SECTION CONTENT PADDING ========== */
.section-content { padding: 20px 24px; flex: 1; }
footer { text-align: center; padding: 22px 0; color: #9ca3af; font-size: 11px; border-top: 1px solid #f3f4f6; margin-top: auto; }

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

/* Hamburger toggle button - hidden on desktop, shown on tablet/mobile */
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    padding: 4px 8px;
    cursor: pointer;
    margin-right: 8px;
}

/* Dimmed click-away overlay behind the mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
}
.sidebar-overlay-visible { display: block; }

@media (max-width: 992px) {
    .sidebar { width: 220px; min-width: 220px; }
}

@media (max-width: 768px) {
    .sidebar-toggle-btn { display: inline-flex; align-items: center; }

    /* Sidebar becomes an off-canvas drawer: fixed, full height, slid out of view by
       default, and only enters the viewport when explicitly opened via the toggle
       button. This avoids fighting the sidebar's own position:fixed declaration,
       which a "stack above content" approach would otherwise conflict with. */
    .sidebar {
        width: 260px;
        min-width: 260px;
        max-width: 80vw;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Content no longer reserves space for a sidebar that isn't visible by default */
    .main-content { margin-left: 0; }

    .top-header { padding: 0 14px; }
    .header-right { gap: 10px; }
    .help-link { padding-right: 10px; }

    .app-wrapper { flex-direction: row; }
    .wizard { flex-wrap: nowrap; overflow-x: auto; }
    .row.g-3 { padding: 0 4px; }
    .section-content { padding: 16px 12px; }

    /* Stat cards and form rows: let Bootstrap's own column stacking do the work,
       but tighten gutters so nothing overflows the viewport width. */
    .stat-card { padding: 12px; }
    .page-header h2 { font-size: 20px; }

    /* Tables wider than the screen scroll horizontally within themselves rather than
       forcing the whole page wider. display:block on the table element itself (rather
       than relying on :has() to target an ancestor) keeps this working on older
       browsers too, while leaving normal table layout (thead/tbody/tr/td) untouched. */
    .data-table { display: block; overflow-x: auto; font-size: 11px; -webkit-overflow-scrolling: touch; }
    .data-table table, .data-table > thead, .data-table > tbody { width: 100%; }
    .data-table th, .data-table td { padding: 8px 6px !important; white-space: nowrap; }
}

@media (max-width: 480px) {
    .section-content { padding: 12px 8px; }
    .form-card, .card { padding: 14px !important; }
}
