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

body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: #dfe5ec;
    color: #1d1d1d;
}

a {
    color: inherit;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #f7f8fa 0%, #eef1f5 100%);
    border-right: 1px solid #c9d1db;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.brand {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #173b73;
    margin-bottom: 4px;
}

.search-box input {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid #c6cfda;
    background: #ffffff;
    outline: none;
    transition: 0.2s ease;
}

.search-box input:focus {
    border-color: #3a67ab;
    box-shadow: 0 0 0 3px rgba(58, 103, 171, 0.12);
}

.sidebar-menu {
    flex: 1;
}

.menu-group {
    margin-top: 8px;
}

.menu-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6a7686;
    letter-spacing: 0.8px;
    margin: 12px 0 10px;
    padding: 0 6px;
}

.menu-link,
.submenu-link {
    display: block;
    padding: 12px 14px;
    color: #243244;
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 8px;
    font-weight: 600;
    transition: 0.2s ease;
}

.menu-link:hover,
.submenu-link:hover {
    background: #1f4a89;
    color: #fff;
    transform: translateX(2px);
}

.logout-form {
    margin-top: auto;
}

.logout-btn {
    width: 100%;
    padding: 12px;
    border: 1px solid #c0c7d1;
    background: #ffffff;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s ease;
}

.logout-btn:hover {
    background: #f4f7fb;
    border-color: #9ba8b8;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    border-bottom: 1px solid #cbd4de;
    background: #f7f9fc;
}

.topbar-date {
    font-weight: 700;
    color: #2e466d;
    font-size: 14px;
}

.admin-content {
    padding: 26px;
}

.page-title {
    font-size: 38px;
    margin-bottom: 24px;
    font-family: Georgia, "Times New Roman", serif;
    color: #243244;
}

.page-panel,
.table-card,
.form-card {
    background: #f9fafc;
    border: 1px solid #c6d0db;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 10px 24px rgba(34, 54, 84, 0.06);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 20px;
    border-radius: 14px;
    border: 1px solid #c8d0db;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
    background: #fff;
}

.stat-card h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 13px;
    color: #4f5d6d;
}

.stat-card.green {
    background: linear-gradient(180deg, #b8d892 0%, #9fc774 100%);
}

.stat-card.blue {
    background: linear-gradient(180deg, #2d5aa3 0%, #1d427d 100%);
    color: #fff;
}

.stat-card.blue p {
    color: rgba(255, 255, 255, 0.85);
}

.stat-number {
    font-size: 34px;
    font-weight: 800;
    margin: 10px 0;
}

.table-card h2 {
    margin-bottom: 18px;
    color: #253346;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    overflow: hidden;
    border-radius: 12px;
}

.data-table thead {
    background: #eef3f8;
}

.data-table th,
.data-table td {
    padding: 16px 12px;
    border-bottom: 1px solid #e0e6ed;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    font-size: 14px;
    color: #425166;
}

.data-table td {
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: #f8fbff;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    display: inline-block;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.status-badge.published {
    background: #92c75d;
    color: #fff;
}

.status-badge.draft {
    background: #efad3d;
    color: #fff;
}

.status-badge.inactive {
    background: #7a8593;
    color: #fff;
}

.btn-primary,
.btn-secondary,
.btn-link {
    border: none;
    text-decoration: none;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 10px;
    display: inline-block;
    font-weight: 700;
    transition: 0.2s ease;
}

.btn-primary {
    background: #1f4a89;
    color: white;
}

.btn-primary:hover {
    background: #183c72;
}

.btn-secondary {
    background: #dde3eb;
    color: #243244;
}

.btn-secondary:hover {
    background: #cfd7e2;
}

.btn-link {
    background: transparent;
    color: #1f4a89;
}

.btn-link:hover {
    color: #173761;
}

.btn-icon {
    background: #eef6ea;
    border: 1px solid #bfd0b8;
    border-radius: 8px;
    padding: 8px 10px;
    text-decoration: none;
    margin-right: 4px;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.btn-icon.danger {
    background: #fae1e1;
    border-color: #e0bcbc;
}

.btn-icon.success {
    background: #e6f7df;
    border-color: #bdddba;
}

.btn-icon.warning {
    background: #fff3d8;
    border-color: #ead39e;
}

.alert-success {
    background: #dcefd8;
    color: #205d20;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    border: 1px solid #b9d8b0;
}

.alert-error {
    background: #f5d6d6;
    color: #7a2020;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    border: 1px solid #dfb2b2;
}

.alert-error ul {
    padding-left: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.create-page-form label {
    display: block;
    margin: 12px 0 8px;
    font-weight: 700;
    color: #2b3950;
}

.create-page-form input,
.create-page-form select {
    width: 100%;
    padding: 12px;
    border: 1px solid #c1c9d4;
    border-radius: 10px;
    background: #fff;
    outline: none;
    transition: 0.2s ease;
}

.create-page-form input:focus,
.create-page-form select:focus {
    border-color: #3a67ab;
    box-shadow: 0 0 0 3px rgba(58, 103, 171, 0.12);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
}

.required {
    color: #b92f4c;
    font-size: 12px;
}

.hint,
.helper-text,
.subtle-note {
    color: #767676;
    font-size: 13px;
    margin-top: 6px;
}

.page-header-row,
.filters-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters-row > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.actions-cell {
    white-space: nowrap;
}

.pagination-wrap {
    margin-top: 18px;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .admin-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #c9d1db;
    }

    .page-title {
        font-size: 30px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.custom-modal-overlay.show {
    display: flex;
}

.custom-modal-box {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 18px;
    padding: 28px 24px;
    text-align: center;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
    animation: modalPop 0.2s ease;
}

.success-modal-box {
    border-top: 6px solid #6bbf59;
}

.custom-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 800;
}

.success-icon {
    background: #e8f7e4;
    color: #2f8f2f;
}

.warning-icon {
    background: #fff3db;
    color: #cc8a00;
}

.custom-modal-box h3 {
    font-size: 24px;
    color: #23344b;
    margin-bottom: 10px;
}

.custom-modal-box p {
    font-size: 15px;
    color: #596779;
    margin-bottom: 22px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.modal-btn {
    min-width: 120px;
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-preview-wrap {
    min-height: 160px;
    position: relative;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-end;
}

.popup-preview-left {
    justify-content: flex-start;
}

.popup-preview-right {
    justify-content: flex-end;
}

.floating-download-popup.preview-only {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    line-height: 1.25;
    max-width: 180px;
}

.popup-download-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.popup-download-text {
    display: inline-block;
    white-space: normal;
    font-weight: 500;
}

/* =========================
   Login Page
========================= */

.login-body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #efefef;
    overflow: hidden;
}

.login-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #efefef;
    overflow: hidden;
}

.login-shape {
    position: absolute;
    z-index: 0;
    pointer-events: none;
}

.login-shape-left {
    left: 0;
    bottom: 0;
    width: 34vw;
    height: 28vh;
    background: linear-gradient(135deg, #5e92ff, #4d7ff2);
    clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

.login-shape-right {
    top: 0;
    right: 0;
    width: 52vw;
    height: 100vh;
    background: linear-gradient(135deg, #7f88e6, #7a82df);
    clip-path: polygon(48% 0, 100% 0, 100% 100%, 0 100%);
}

.login-card {
    position: relative;
    z-index: 2;
    width: 260px;
    min-height: 355px;
    background: #f3f3f3;
    border-radius: 18px;
    padding: 34px 26px 38px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
    text-align: center;
}

.login-title {
    margin: 0 0 28px;
    font-size: 22px;
    font-weight: 700;
    color: #111111;
}

.login-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.login-input {
    width: 100%;
    height: 38px;
    border: none;
    outline: none;
    border-radius: 14px;
    padding: 0 16px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    font-size: 14px;
    color: #444444;
}

.login-input::placeholder {
    color: #666666;
}

.login-input:focus {
    box-shadow: 0 0 0 3px rgba(168, 128, 234, 0.18), 0 4px 12px rgba(0, 0, 0, 0.12);
}

.login-btn {
    margin-top: 12px;
    width: 100px;
    height: 38px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #b58cf2, #a67fe8);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(166, 127, 232, 0.42);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(166, 127, 232, 0.5);
}

.login-btn:active {
    transform: translateY(0);
}

@media (max-width: 640px) {
    .login-card {
        width: min(88vw, 300px);
        padding: 30px 22px 34px;
    }

    .login-shape-left {
        width: 42vw;
        height: 22vh;
    }

    .login-shape-right {
        width: 58vw;
    }
}

.drop-zone {
    position: relative;
}

.canvas-block.website-background-block {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    min-height: 100%;
    border: 1px dashed #b8c4d9;
    pointer-events: none;
}

.canvas-block:not(.website-background-block) {
    position: relative;
    z-index: 1;
}

.canvas-block.popup-block {
    position: relative;
    z-index: 50;
}