/* ===== Admin Panel CSS ===== */
/* Based on Design System Variables */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    /* Kopitiam Palette */
    --bg: #F0EFEA;
    --card: #FFFFFF;
    --text: #191919;
    --muted: #66605B;
    --pill: #191919;
    --pill-text: #FFFFFF;
    --stroke: #D6D1CA;
    --badge-bg: #E6E4DD;
    --badge-text: #191919;
    --input-bg: #FFFFFF;
    --input-border: #D6D1CA;

    --serif: "Libre Baskerville", serif;
    --sans: "Inter", sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Status Colors */
    --badge-green-bg: #E6F3E6;
    --badge-green-text: #2D6A4F;
    --badge-draft-bg: #F3F3F3;
    --badge-draft-text: #66605B;
    --badge-red-text: #c94a4a;
}

/* ===== Global ===== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

/* ===== Sidebar ===== */

.admin-sidebar {
    width: 260px;
    background: var(--bg);
    border-right: 1px solid var(--stroke);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    padding: 32px 24px;
    z-index: 100;
}

.brand-title {
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 48px;
    text-decoration: none;
    display: block;
    letter-spacing: -0.5px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: rgba(0, 0, 0, 0.03);
}

.nav-link.active {
    font-weight: 600;
}

.nav-link i {
    font-size: 16px;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--stroke);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.logout-link {
    color: #c94a4a;
}

.logout-link:hover {
    background: rgba(201, 74, 74, 0.05);
    color: #c94a4a;
}

/* ===== Main Content ===== */

.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 40px 64px;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.mb-5 {
    margin-bottom: 3rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mb-6 {
    margin-bottom: 4rem;
}

/* ===== Top Bar ===== */

.breadcrumb-text {
    font-size: 14px;
    color: var(--muted);
}

.breadcrumb-text span {
    color: var(--text);
    font-weight: 500;
}

.profile-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pill);
    color: var(--pill-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Page Header ===== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-title {
    font-family: var(--serif);
    font-size: 32px;
    font-weight: 400;
    color: var(--text);
    margin: 0 0 8px;
}

.page-subtitle {
    color: var(--muted);
    font-size: 16px;
    margin: 0;
}

/* ===== Filters Bar ===== */

.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input {
    flex: 1;
    max-width: 400px;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--stroke);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--input-text);
    font-family: var(--sans);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--text);
}

.search-input::placeholder {
    color: var(--input-placeholder);
}

.custom-select {
    padding: 10px 12px;
    border: 1px solid var(--stroke);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--input-text);
    font-family: var(--sans);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.custom-select:focus {
    border-color: var(--text);
}

.btn-secondary {
    padding: 10px 16px;
    border: 1px solid var(--stroke);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--badge-bg);
}

/* ===== Table ===== */

.table-card {
    border: 1px solid var(--stroke);
    border-radius: 12px;
    overflow: hidden;
    background: var(--card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.table-responsive {
    overflow-x: auto;
}

.simple-table {
    width: 100%;
    border-collapse: collapse;
}

.simple-table th {
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px;
    border-bottom: 1px solid var(--stroke);
    background: var(--card);
}

.simple-table td {
    padding: 16px;
    border-bottom: 1px solid var(--stroke);
    font-size: 15px;
    color: var(--muted);
}

.simple-table tr:last-child td {
    border-bottom: none;
}

.simple-table .primary-text {
    color: var(--text);
    font-family: var(--serif);
    font-size: 16px;
}

.simple-table .text-right {
    text-align: right;
}

/* ===== Badges ===== */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.badge-published {
    background: var(--badge-green-bg);
    color: var(--badge-green-text);
}

.badge-draft {
    background: var(--badge-draft-bg);
    color: var(--badge-draft-text);
}

.badge-rejected {
    background: rgba(201, 74, 74, 0.1);
    color: #c94a4a;
}

/* ===== Action Links ===== */

.action-link {
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.action-link:hover {
    opacity: 0.7;
    text-decoration: none;
}

.action-link.delete {
    color: #c94a4a;
}

/* ===== Stats Grid ===== */

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

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

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    padding: 24px;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    background: transparent;
}

.stat-card .label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.stat-card .value {
    font-family: var(--serif);
    font-size: 32px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1;
}

.stat-card .trend {
    font-size: 13px;
    color: var(--muted);
}

.stat-card .trend.up {
    color: #4a7c59;
}

/* ===== Custom Modal (for users.html) ===== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1050;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal > .modal-content {
    background: var(--card, #FAF9F6);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--stroke, #E5E5E5);
}

/* ===== Bootstrap Modal Override ===== */

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
}

.modal-dialog .modal-content {
    background: var(--card, #FAF9F6);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--stroke, #E5E5E5);
}

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-backdrop.show {
    opacity: 1;
}

/* ===== Modal Common Styles ===== */

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--stroke, #E5E5E5);
    background: var(--card, #FAF9F6);
}

.modal-title {
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 500;
    color: var(--text, #1a1a1a);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text);
}

.modal-header .btn-close {
    opacity: 0.6;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 24px;
    background: var(--card, #FAF9F6);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 600px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.detail-value {
    font-size: 15px;
    color: var(--text);
    margin: 0;
    font-weight: 500;
}

.detail-section {
    margin-bottom: 24px;
}

.section-title {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 400;
    color: var(--text);
    margin: 0 0 16px;
}

.activity-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
}

.activity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-label {
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
}

.activity-value {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--stroke, #E5E5E5);
    background: var(--card, #FAF9F6);
}

/* ===== Comments List (Admin) ===== */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg, #EBE9E4);
    border-radius: 8px;
    position: relative;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--text, #1a1a1a);
}

.comment-date {
    font-size: 12px;
    color: var(--muted, #666);
}

.comment-text {
    font-size: 14px;
    color: var(--text, #1a1a1a);
    line-height: 1.5;
    word-break: break-word;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted, #666);
}

.comment-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #c94a4a;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s, background 0.2s;
}

.comment-delete-btn:hover {
    opacity: 1;
    background: rgba(201, 74, 74, 0.1);
}

.comment-inactive {
    opacity: 0.5;
    background: #f5f5f5;
}

.comment-inactive::after {
    content: 'Hidden';
    position: absolute;
    top: 8px;
    right: 50px;
    font-size: 11px;
    color: #999;
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 3px;
}

.btn-primary {
    padding: 10px 16px;
    background: var(--pill);
    color: var(--pill-text);
    border: none;
    border-radius: 6px;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-danger {
    padding: 10px 16px;
    background: rgba(201, 74, 74, 0.1);
    color: #c94a4a;
    border: 1px solid #c94a4a;
    border-radius: 6px;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #c94a4a;
    color: var(--pill-text);
}

/* ===== Password Management ===== */

.password-section {
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
}

.password-hint {
    font-size: 14px;
    color: var(--muted);
    margin: 0 0 12px;
}

.btn-reset-password {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--badge-bg);
    color: var(--text);
    border: 1px solid var(--stroke);
    border-radius: 6px;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset-password:hover {
    background: var(--stroke);
    border-color: var(--text);
}

.btn-reset-password i {
    font-size: 16px;
}

.password-display {
    margin-top: 12px;
}

.password-display.hidden {
    display: none;
}

.password-info {
    padding: 12px;
    background: var(--card);
    border: 1px solid #ffd700;
    border-radius: 6px;
}

.password-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 8px;
}

.password-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.password-field {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--stroke);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--input-text);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
}

.toggle-password-btn,
.copy-btn {
    padding: 8px 12px;
    background: var(--pill);
    color: var(--pill-text);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password-btn:hover,
.copy-btn:hover {
    opacity: 0.9;
}

.toggle-password-btn i,
.copy-btn i {
    font-size: 16px;
}

.current-password-box,
.edit-password-box {
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: 6px;
    margin-bottom: 16px;
}

.btn-save-password {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #4a7c59;
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-save-password:hover {
    background: #3a5f48;
    transform: translateY(-1px);
}

.btn-save-password i {
    font-size: 16px;
}

.password-strength {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    background: var(--badge-bg);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: all 0.3s ease;
    background: #d94545;
}

.strength-fill.weak {
    width: 25%;
    background: #d94545;
}

.strength-fill.fair {
    width: 50%;
    background: #ffa500;
}

.strength-fill.good {
    width: 75%;
    background: #ffc107;
}

.strength-fill.strong {
    width: 100%;
    background: #4a7c59;
}

.strength-text {
    font-size: 12px;
    color: var(--muted);
}

/* ===== Edit Form ===== */

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--stroke);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--input-text);
    font-family: var(--sans);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.form-input:focus {
    border-color: var(--text);
}

.form-input::placeholder {
    color: var(--input-placeholder);
}

.form-error {
    font-size: 12px;
    color: #d94545;
    display: block;
    min-height: 16px;
}

.form-error.hidden {
    display: none;
}

/* Status Toggle */

.status-toggle {
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 12px;
}

.toggle-input {
    width: 0;
    height: 0;
    opacity: 0;
}

.toggle-slider {
    width: 48px;
    height: 28px;
    background: var(--stroke);
    border-radius: 14px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

.toggle-input:checked + .toggle-slider {
    background: #4a7c59;
}

.toggle-input:checked + .toggle-slider::after {
    left: 22px;
}

.toggle-text {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
    min-width: 60px;
}

.detail-notes {
    padding: 12px;
    background: var(--bg);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    min-height: 80px;
    display: flex;
    align-items: flex-start;
}

.password-warning {
    font-size: 12px;
    color: #d94545;
    margin: 0;
    padding: 8px;
    background: rgba(217, 69, 69, 0.05);
    border-radius: 4px;
    line-height: 1.4;
}

.hidden {
    display: none !important;
}

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

@media (max-width: 768px) {
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--stroke);
    }

    .admin-main {
        margin-left: 0;
        padding: 24px 16px;
    }

    .section-header {
        flex-direction: column;
    }

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

    .filters-bar {
        flex-direction: column;
    }

    .search-input {
        max-width: 100%;
        width: 100%;
    }
}
