/* Dashboard Layout */
.dashboard-section {
    background: #f5f7fa;
    min-height: 100vh;
    padding: 0;
    display: none;
}

.dashboard-section.active {
    display: block;
}

.container-fluid {
    max-width: 100%;
    padding: 0;
}

.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Sidebar */
.dashboard-sidebar {
    width: 260px;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i {
    font-size: 40px;
    color: #ff6b35;
    margin-bottom: 10px;
}

.sidebar-header h3 {
    font-size: 20px;
    margin: 0;
}

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

/* Sidebar User Info */
.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user-avatar i {
    font-size: 36px;
    color: #ff6b35;
}

.sidebar-user-details {
    display: flex;
    flex-direction: column;
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.sidebar-user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    margin-top: 2px;
}

/* Sidebar Logout */
.sidebar-logout {
    padding: 14px 12px;
    border-top: 1px solid rgba(255,255,255,0.10);
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: rgba(231, 76, 60, 0.08);
    border: 1.5px solid rgba(231, 76, 60, 0.18);
    border-radius: 10px;
    color: #e74c3c;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s ease;
    text-align: left;
    letter-spacing: 0.01em;
}

.sidebar-logout-btn:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
    box-shadow: 0 4px 16px rgba(231,76,60,0.22);
    transform: translateY(-1px);
}

.sidebar-logout-btn i {
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

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

.sidebar-link.active {
    background: #ff6b35;
    color: white;
}

.sidebar-link i {
    width: 25px;
    margin-right: 15px;
    font-size: 18px;
}

.sidebar-link .badge {
    margin-left: auto;
    background: #ff6b35;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
}

/* Main Content */
.dashboard-main {
    margin-left: 260px;
    flex: 1;
    padding: 0;
    min-width: 0;
    overflow-x: hidden;
    width: calc(100% - 260px);
}

.dashboard-topbar {
    background: white;
    padding: 18px 32px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.dashboard-topbar h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 28px;
}

.topbar-actions {
    display: flex;
    gap: 15px;
}

/* Dashboard Tabs */
.dashboard-tab {
    display: none;
    padding: 40px;
}

.dashboard-tab.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.tab-header h3 {
    font-size: 24px;
    color: #2c3e50;
    margin: 0;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-box {
    background: white;
    border-radius: 15px;
    padding: 25px;
    display: flex;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.stat-info h4 {
    font-size: 14px;
    color: #7f8c8d;
    margin: 0 0 8px 0;
    font-weight: 500;
}

.stat-info h3 {
    font-size: 32px;
    color: #2c3e50;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.stat-change {
    font-size: 13px;
    color: #7f8c8d;
}

.stat-change.positive {
    color: #27ae60;
}

.stat-change i {
    margin-right: 5px;
}

/* Dashboard Row */
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-bottom: 40px;
}

.dashboard-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.dashboard-card h3 {
    font-size: 20px;
    color: #2c3e50;
    margin: 0 0 25px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-card h3 i {
    color: #ff6b35;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    border-bottom: 2px solid #e9ecef;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    color: #7f8c8d;
    font-size: 14px;
}

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

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.success {
    background: #d4edda;
    color: #155724;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.btn-icon {
    background: none;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    padding: 5px 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    color: #ff6b35;
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.activity-item {
    display: flex;
    gap: 15px;
}

.activity-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.activity-content p {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 14px;
}

.activity-content span {
    color: #7f8c8d;
    font-size: 13px;
    display: block;
    margin-bottom: 3px;
}

.activity-content small {
    color: #95a5a6;
    font-size: 12px;
}

/* Programs Grid */
.programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.program-manage-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.program-manage-card h4 {
    font-size: 20px;
    color: #2c3e50;
    margin: 0 0 10px 0;
}

.program-manage-card p {
    color: #7f8c8d;
    margin: 0 0 20px 0;
}

.program-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #7f8c8d;
}

.program-stats i {
    color: #ff6b35;
    margin-right: 5px;
}

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

/* Content Sections */
.content-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.content-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
}

.content-card h4 {
    font-size: 18px;
    color: #2c3e50;
    margin: 0 0 10px 0;
}

.content-card h4 i {
    color: #ff6b35;
    margin-right: 8px;
}

.content-card p {
    color: #7f8c8d;
    margin: 0 0 20px 0;
    font-size: 14px;
}

/* Messages */
.message-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message-item {
    padding: 20px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.message-item:hover {
    border-color: #ff6b35;
    box-shadow: 0 2px 10px rgba(255,107,53,0.1);
}

.message-item.unread {
    background: #fff8f5;
    border-color: #ff6b35;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.message-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 16px;
}

.message-time {
    color: #7f8c8d;
    font-size: 13px;
}

.message-item p {
    margin: 8px 0;
    color: #7f8c8d;
    font-size: 14px;
}

.message-preview {
    color: #2c3e50 !important;
    margin-bottom: 15px !important;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-form .form-group {
    margin: 0;
}

.settings-form label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 14px;
}

.settings-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.settings-form input:focus {
    outline: none;
    border-color: #ff6b35;
}

/* Popup Modals */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.popup.active {
    display: flex;
}

.popup-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 10001;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10002;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.sidebar-toggle-btn {
    display: none !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: #f0f4f8;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    color: #2c3e50;
    font-size: 16px;
    cursor: pointer;
    margin-right: 14px;
    flex-shrink: 0;
    transition: background 0.2s, box-shadow 0.2s;
}

.sidebar-toggle-btn:hover {
    background: #e2e8f0;
    box-shadow: 0 2px 8px rgba(44,62,80,0.10);
}

.sidebar-overlay {
    display: none;
}

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

/* =====================
   TABLET: Icon-only sidebar (968px)
   ===================== */
@media (max-width: 968px) {
    .dashboard-sidebar {
        width: 72px;
        flex-shrink: 0;
    }

    .sidebar-header h3,
    .sidebar-link span,
    .sidebar-user-details,
    .sidebar-logout-btn span {
        display: none !important;
    }

    .sidebar-header {
        padding: 16px 8px;
    }

    .sidebar-header img {
        width: 36px !important;
        height: 36px !important;
    }

    .sidebar-user-info {
        justify-content: center;
        padding: 10px 0;
    }

    .sidebar-logout {
        padding: 10px 6px;
    }

    .sidebar-logout-btn {
        justify-content: center;
        padding: 0;
        width: 40px;
        height: 40px;
        margin: 0 auto;
        border-radius: 10px;
        background: rgba(231,76,60,0.10);
        border-color: rgba(231,76,60,0.20);
        min-width: unset;
    }

    .sidebar-link {
        justify-content: center;
        padding: 14px 0;
    }

    .sidebar-link i {
        margin: 0;
        width: auto;
        font-size: 20px;
    }

    .sidebar-link .badge {
        position: absolute;
        top: 8px;
        right: 8px;
        margin: 0;
        padding: 2px 5px;
        font-size: 10px;
    }

    .dashboard-main {
        margin-left: 72px;
        min-width: 0;
        width: calc(100% - 72px);
        overflow-x: hidden;
    }

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

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-tab {
        padding: 24px 20px;
    }

    .dashboard-topbar {
        padding: 14px 20px;
    }

    .dashboard-topbar h2 {
        font-size: 22px;
    }
}

/* =====================
   MOBILE: Slide-in sidebar (768px)
   ===================== */
@media (max-width: 768px) {
    .dashboard-sidebar {
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
        z-index: 999;
    }

    /* Restore full labels when sidebar is open on mobile */
    .dashboard-sidebar.open .sidebar-header h3,
    .dashboard-sidebar.open .sidebar-link span,
    .dashboard-sidebar.open .sidebar-user-details,
    .dashboard-sidebar.open .sidebar-logout-btn span {
        display: block !important;
    }

    .dashboard-sidebar.open .sidebar-logout-btn span {
        display: inline !important;
    }

    .dashboard-sidebar.open .sidebar-link {
        justify-content: flex-start;
        padding: 14px 24px;
    }

    .dashboard-sidebar.open .sidebar-link i {
        margin-right: 14px;
        width: 22px;
        font-size: 18px;
    }

    .dashboard-sidebar.open .sidebar-user-info {
        justify-content: flex-start;
        padding: 14px 20px;
    }

    .dashboard-sidebar.open .sidebar-logout-btn {
        justify-content: flex-start;
        width: 100%;
        height: auto;
        padding: 11px 16px;
        margin: 0;
    }

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

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 998;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Show hamburger toggle on mobile */
    .sidebar-toggle-btn {
        display: flex !important;
    }

    /* Full width main — no margin */
    .dashboard-main {
        margin-left: 0 !important;
        width: 100% !important;
        min-width: 0;
        overflow-x: hidden;
    }

    .dashboard-topbar {
        padding: 12px 16px;
    }

    .dashboard-topbar h2 {
        font-size: 18px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    .topbar-actions .btn span {
        display: none;
    }

    .topbar-actions .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .dashboard-tab {
        padding: 16px 12px;
    }

    /* Tables scroll horizontally */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
        width: 100%;
    }

    .data-table {
        font-size: 13px;
        min-width: 540px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        white-space: nowrap;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-box {
        padding: 14px 12px;
        gap: 10px;
        border-radius: 12px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 10px;
        flex-shrink: 0;
    }

    .stat-info h3 {
        font-size: 20px;
    }

    .stat-info h4 {
        font-size: 12px;
    }

    .stat-change {
        font-size: 11px;
    }

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

    .tab-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tab-header h3 {
        font-size: 18px;
    }

    .tab-header > div {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

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

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

    .content-sections {
        grid-template-columns: 1fr;
    }

    .dashboard-card {
        padding: 16px;
        border-radius: 12px;
    }

    .dashboard-card h3 {
        font-size: 16px;
    }

    .popup-content {
        padding: 20px 14px;
        border-radius: 14px;
    }

    /* Members filter grid */
    .members-filter-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Signature settings grid */
    .signature-settings-grid {
        grid-template-columns: 1fr !important;
    }

    /* Donation stats grid */
    .donations-stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Gallery stats grid */
    .gallery-stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* =====================
   EXTRA SMALL (480px)
   ===================== */
@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .stat-box {
        flex-direction: row;
        align-items: center;
    }

    .dashboard-topbar h2 {
        font-size: 15px;
        max-width: 140px;
    }

    .members-filter-grid {
        grid-template-columns: 1fr !important;
    }

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

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