/* ===== Admin Portal Layout ===== */

/* Sidebar */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background: #BF060A;
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: hidden;
}

.admin-sidebar.collapsed {
    width: 60px;
}

.admin-sidebar-logo {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 70px;
}

.admin-sidebar-logo img {
    height: 40px;
    flex-shrink: 0;
}

.admin-sidebar-logo span {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
}

.admin-sidebar.collapsed .admin-sidebar-logo span {
    display: none;
}

/* Sidebar Nav */
.admin-sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.admin-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.admin-sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.admin-sidebar-nav a.active {
    background: #8e0407;
    color: white;
    font-weight: 600;
}

.admin-sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.admin-sidebar.collapsed .admin-sidebar-nav a span {
    display: none;
}

/* Sidebar Collapse Toggle */
.admin-sidebar-toggle {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    transition: color 0.2s;
}

.admin-sidebar-toggle:hover {
    color: white;
}

.admin-sidebar-toggle i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: transform 0.3s;
}

.admin-sidebar.collapsed .admin-sidebar-toggle i {
    transform: rotate(180deg);
}

.admin-sidebar.collapsed .admin-sidebar-toggle span {
    display: none;
}

/* Top Bar */
.admin-topbar {
    position: fixed;
    top: 0;
    left: 250px;
    right: 0;
    height: 60px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
    transition: left 0.3s ease;
}

.admin-sidebar.collapsed ~ .admin-topbar {
    left: 60px;
}

.admin-topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: #2a2a2a;
}

.admin-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-topbar-user {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.admin-topbar-user i {
    color: #BF060A;
    margin-right: 4px;
}

.admin-topbar-logout {
    background: none;
    border: 1px solid #dc2626;
    color: #dc2626;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.admin-topbar-logout:hover {
    background: #dc2626;
    color: white;
}

/* Content Area */
.admin-content {
    margin-left: 250px;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
    background: #fbf8f6;
    padding: 24px;
    transition: margin-left 0.3s ease;
}

.admin-sidebar.collapsed ~ .admin-content {
    margin-left: 60px;
}

/* Page Header */
.admin-page-header {
    margin-bottom: 24px;
}

.admin-page-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #2a2a2a;
    margin: 0 0 4px 0;
}

.admin-page-header p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Grid Toolbar (Search + Add button) */
.admin-grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-grid-search {
    flex: 1;
    max-width: 350px;
    position: relative;
}

.admin-grid-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.admin-grid-search input:focus {
    border-color: #BF060A;
}

.admin-grid-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
}

.admin-grid-add-btn {
    background: #BF060A;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.admin-grid-add-btn:hover {
    background: #8e0407;
}

/* Table (reuses patterns from MyDonations but in admin context) */
.admin-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.03);
}

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

.admin-table thead th {
    font-size: 12px;
    color: #888;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    border-bottom: 2px solid #f0f0f0;
    text-align: left;
    cursor: default;
    white-space: nowrap;
    user-select: none;
}

.admin-table thead th.sortable {
    cursor: pointer;
}

.admin-table thead th.sortable:hover {
    color: #BF060A;
}

.admin-table thead th .sort-icon {
    margin-left: 4px;
    font-size: 10px;
    color: #ccc;
}

.admin-table thead th.sort-asc .sort-icon,
.admin-table thead th.sort-desc .sort-icon {
    color: #BF060A;
}

.admin-table tbody td {
    padding: 12px 12px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
}

.admin-table tbody tr:hover {
    background: #fafafa;
}

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

/* Action Buttons in Table */
.admin-action-btns {
    display: flex;
    gap: 6px;
}

.admin-btn-edit {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-btn-edit:hover {
    background: #2563eb;
}

.admin-btn-delete {
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-btn-delete:hover {
    background: #b91c1c;
}

.admin-btn-activate {
    background: #BF060A;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-btn-activate:hover {
    background: #8e0407;
}

/* Status Badge */
.admin-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.admin-badge-active {
    background: #f0fdf4;
    color: #16a34a;
}

.admin-badge-inactive {
    background: #fef2f2;
    color: #dc2626;
}

.admin-badge-pending {
    background: #fff7ed;
    color: #ea580c;
}

/* Amount */
.admin-amount {
    font-weight: 700;
    color: #BF060A;
}

/* Modal / Popup */
.admin-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: flex-start;
    padding-top: 60px;
}

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

.admin-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.admin-modal-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #2a2a2a;
    margin: 0;
}

.admin-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px;
}

.admin-modal-close:hover {
    color: #333;
}

.admin-modal-body {
    padding: 20px 24px;
}

.admin-modal-body .popup-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.admin-modal-body .popup-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    margin-bottom: 14px;
}

.admin-modal-body .popup-input:focus {
    border-color: #BF060A;
}

.admin-modal-body select.popup-input {
    appearance: auto;
}

.admin-modal-body textarea.popup-input {
    min-height: 80px;
    resize: vertical;
}

.admin-modal-footer {
    padding: 0 24px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.admin-modal-save {
    background: #BF060A;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-modal-save:hover:not(:disabled) {
    background: #8e0407;
}

.admin-modal-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-modal-cancel {
    background: #f3f4f6;
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-modal-cancel:hover {
    background: #e5e7eb;
}

/* Error in modal */
.admin-modal-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 14px;
    border: 1px solid #fecaca;
    display: none;
}

/* Loading State */
.admin-loading {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 15px;
}

/* Empty State */
.admin-empty {
    text-align: center;
    padding: 48px 20px;
    color: #888;
}

.admin-empty i {
    font-size: 40px;
    color: #d0d0d0;
    margin-bottom: 12px;
    display: block;
}

.admin-empty p {
    font-size: 14px;
    margin: 0;
}

/* Dashboard Stat Cards */
.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.admin-stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.03);
    text-align: center;
}

.admin-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #BF060A;
    margin-bottom: 4px;
}

.admin-stat-label {
    font-size: 13px;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard Tables Row */
.admin-dashboard-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.admin-dashboard-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.admin-dashboard-card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #2a2a2a;
    margin: 0;
}

.admin-viewall-btn {
    background: #BF060A;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.admin-viewall-btn:hover {
    background: #8e0407;
    color: white;
}

/* Table row count / info */
.admin-grid-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 13px;
    color: #888;
}

/* Mobile Hamburger */
.admin-hamburger {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1001;
    background: #BF060A;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 18px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        width: 250px !important;
    }

    .admin-sidebar.mobile-open {
        transform: translateX(0);
    }

    .admin-topbar {
        left: 0 !important;
    }

    .admin-content {
        margin-left: 0 !important;
    }

    .admin-hamburger {
        display: block;
    }

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

    .admin-dashboard-tables {
        grid-template-columns: 1fr;
    }

    .admin-table {
        min-width: 600px;
    }

    .admin-card {
        overflow-x: auto;
    }

    .admin-grid-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-grid-search {
        max-width: none;
    }
}

@media (max-width: 1024px) {
    .admin-dashboard-tables {
        grid-template-columns: 1fr;
    }
}
