:root {
    --primary-color: #0056b3; /* Darker Blue for a more professional feel */
    --primary-color-light: #007bff; /* Original primary for accents */
    --secondary-color: #5a6268; /* Slightly darker gray */
    --success-color: #218838; /* Darker Green */
    --danger-color: #c82333;  /* Darker Red */
    --warning-color: #e0a800; /* Darker Yellow */
    --info-color: #138496;   /* Darker Teal */
    --light-color: #fdfdff; /* Off-white for a softer look */
    --dark-color: #212529;  /* Darker Gray for text and elements */
    --background-color: #f4f7f6; /* Very light gray for main background */
    --sidebar-bg: #2c3e50; /* Dark blue/gray for sidebar */
    --sidebar-link-color: #bdc3c7; /* Light gray for sidebar links */
    --sidebar-link-hover-bg: #34495e; /* Slightly darker for hover */
    --sidebar-link-active-bg: var(--primary-color);

    --font-family-sans-serif: 'Tajawal', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-sm: 0.875rem;
    --line-height-base: 1.7;
    --border-radius: 0.35rem; /* Slightly more rounded */
    --box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
    --box-shadow-lg: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
    --container-max-width: 1280px;
    --sidebar-width: 260px;
    --header-height: 60px;
}

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-sans-serif);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: var(--line-height-base);
    color: var(--dark-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Login & Register Page Styles */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.8rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.auth-card h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: #3498db;
    border-radius: 2px;
}

.auth-card h2 i {
    margin-left: 0.5rem;
    color: #3498db;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
}

.input-group {
    position: relative;
}

.input-group .input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
    transition: color 0.3s ease;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    outline: none;
}

.form-control:focus + .input-icon {
    color: #3498db;
}

.form-control.is-invalid {
    border-color: #e74c3c;
}

.form-control.is-invalid + .input-icon {
    color: #e74c3c;
}

.form-control.is-valid {
    border-color: #2ecc71;
}

.form-control.is-valid + .input-icon {
    color: #2ecc71;
}

.toggle-password {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #3498db;
}

.form-text {
    display: block;
    margin-top: 0.5rem;
    color: #7f8c8d;
    font-size: 0.875rem;
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.form-check-input {
    margin-left: 0.5rem;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #e0e0e0;
    border-radius: 3px;
    cursor: pointer;
}

.form-check-label {
    color: #2c3e50;
    cursor: pointer;
}

.form-check-label a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.form-check-label a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.btn-submit {
    width: 100%;
    padding: 0.75rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-submit:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit.loading {
    background: #2980b9;
    cursor: not-allowed;
}

.btn-submit i {
    font-size: 1.1rem;
}

.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-danger {
    background: #fde8e8;
    color: #e74c3c;
    border: 1px solid #fad2d2;
}

.alert-success {
    background: #e8f8e8;
    color: #2ecc71;
    border: 1px solid #d2fad2;
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    color: #7f8c8d;
}

.auth-links a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.auth-links a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.auth-links .separator {
    margin: 0 0.5rem;
    color: #bdc3c7;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
    }
    
    .auth-card h2 {
        font-size: 1.5rem;
    }
    
    .form-control {
        padding: 0.625rem 0.875rem;
        padding-right: 2.25rem;
    }
    
    .btn-submit {
        padding: 0.625rem;
    }
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-link-color);
    padding: 20px 0;
    transition: transform 0.3s ease;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar.collapsed {
    transform: translateX(100%);
}

.sidebar-header {
    padding: 0 20px 15px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--sidebar-link-hover-bg);
}

.sidebar-header h1 {
    font-size: 1.6rem;
    margin: 0;
    text-align: center;
    color: var(--light-color);
    font-weight: 700;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar nav ul li a {
    display: flex; /* For icon alignment */
    align-items: center; /* For icon alignment */
    padding: 12px 20px;
    color: var(--sidebar-link-color);
    text-decoration: none;
    border-right: 3px solid transparent; /* Active indicator */
    margin-bottom: 2px;
    transition: background-color 0.2s ease, color 0.2s ease, border-right-color 0.2s ease;
    font-weight: 500;
}

.sidebar nav ul li a:hover {
    background-color: var(--sidebar-link-hover-bg);
    color: white;
}

.sidebar nav ul li a.active {
    background-color: var(--sidebar-link-active-bg);
    color: white;
    border-right-color: var(--primary-color-light);
    font-weight: 700;
}

.sidebar nav ul li a .icon { /* Placeholder for icons */
    margin-left: 10px;
    font-size: 1.1em;
}

.main-content {
    flex-grow: 1;
    padding-right: var(--sidebar-width); /* Account for fixed sidebar */
    padding-top: var(--header-height);
    transition: padding-right 0.3s ease;
    background-color: var(--background-color);
}

.main-content.sidebar-collapsed {
    padding-right: 0;
}

.dashboard-header {
    background-color: var(--light-color);
    padding: 0 30px;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    position: fixed;
    top: 0;
    right: var(--sidebar-width); /* Adjust based on sidebar */
    left: 0;
    z-index: 999;
    transition: right 0.3s ease;
}

.dashboard-header.sidebar-collapsed {
    right: 0;
}

.hamburger-menu {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--dark-color);
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.2s ease;
}

.hamburger-menu:hover {
    color: var(--primary-color);
}

.dashboard-header .user-info {
    display: flex;
    align-items: center;
}

.dashboard-header .user-info span {
    margin-left: 15px;
    font-weight: 500;
    color: var(--dark-color);
}

.page-content {
    padding: 30px;
}

.page-content h2.page-title {
    margin-bottom: 30px; /* Increased margin */
}

/* Dashboard Grid and Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive grid */
    gap: 25px;
    margin-top: 20px;
}

.dashboard-card {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center; /* Align icon and content */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 5px solid var(--primary-color); /* Accent border */
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.dashboard-card .card-icon {
    font-size: 2.5rem; /* Larger icon */
    margin-right: 20px; /* Space between icon and text */
    color: var(--primary-color);
    width: 60px; /* Fixed width for icon container */
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 86, 179, 0.1); /* Light background for icon */
    border-radius: 50%;
}

.dashboard-card.card-danger .card-icon {
    color: var(--danger-color);
    background-color: rgba(200, 35, 51, 0.1);
}
.dashboard-card.card-danger {
    border-left-color: var(--danger-color);
}

.dashboard-card.card-warning .card-icon {
    color: var(--warning-color);
    background-color: rgba(224, 168, 0, 0.1);
}
.dashboard-card.card-warning {
    border-left-color: var(--warning-color);
}


.dashboard-card .card-content h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.1rem; /* Slightly smaller heading */
    color: var(--secondary-color);
    font-weight: 600;
}

.dashboard-card .card-content .stat-number {
    font-size: 2.2rem; /* Larger stat number */
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

/* Responsive adjustments for dashboard cards */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr; /* Single column on smaller screens */
    }
    .dashboard-card {
        flex-direction: column; /* Stack icon and text vertically */
        text-align: center;
    }
    .dashboard-card .card-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }
}


/* Styling for parts/templates.php and similar pages */
.page-title {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    font-weight: 700;
    font-size: 1.75rem;
}

/* Buttons */
.btn {
    padding: 10px 22px;
    border-radius: var(--border-radius);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: inline-block;
    text-align: center;
    line-height: 1.5;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.btn-primary:hover {
    background-color: var(--primary-color-light);
    border-color: var(--primary-color-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}
.btn-secondary:hover {
    background-color: #495057; /* Darken */
    border-color: #495057;
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    border-color: var(--success-color);
}
.btn-success:hover {
    background-color: #1e7e34; /* Darken */
    border-color: #1e7e34;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}
.btn-danger:hover {
    background-color: #bd2130; /* Darken */
    border-color: #bd2130;
    transform: translateY(-1px);
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--dark-color);
    border-color: var(--warning-color);
}
.btn-warning:hover {
    background-color: #d39e00; /* Darken */
    border-color: #d39e00;
    transform: translateY(-1px);
}

.btn-info {
    background-color: var(--info-color);
    color: white;
    border-color: var(--info-color);
}
.btn-info:hover {
    background-color: #117a8b; /* Darken */
    border-color: #117a8b;
    transform: translateY(-1px);
}

.btn-light {
    background-color: var(--light-color);
    color: var(--dark-color);
    border-color: #ced4da;
}
.btn-light:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 12px 28px;
    font-size: var(--font-size-lg);
}

.btn-icon {
    padding: 8px 10px;
}
.btn-icon .icon {
    margin: 0;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Forms (general for dashboard parts) */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--secondary-color);
}

.form-control {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: rgba(255,255,255,0.9);
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control:focus {
    border-color: var(--primary-color-light);
    box-shadow: 0 6px 12px rgba(0,123,255,0.15);
}

.form-control:focus {
    color: var(--dark-color);
    background-color: var(--light-color);
    border-color: var(--primary-color-light);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-check {
    display: flex;
    align-items: center;
}
.form-check-input {
    margin-left: 8px;
    margin-top: 0.1rem;
}
.form-check-label {
    margin-bottom: 0;
}

/* Tables */

/* Styling for parts/templates.php and similar pages */
.page-title {
    margin-bottom: 30px; /* Increased margin */
}

/* Dashboard Grid and Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive grid */
    gap: 25px;
    margin-top: 20px;
}

.dashboard-card {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center; /* Align icon and content */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 5px solid var(--primary-color); /* Accent border */
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.dashboard-card .card-icon {
    font-size: 2.5rem; /* Larger icon */
    margin-right: 20px; /* Space between icon and text */
    color: var(--primary-color);
    width: 60px; /* Fixed width for icon container */
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 86, 179, 0.1); /* Light background for icon */
    border-radius: 50%;
}

.dashboard-card.card-danger .card-icon {
    color: var(--danger-color);
    background-color: rgba(200, 35, 51, 0.1);
}
.dashboard-card.card-danger {
    border-left-color: var(--danger-color);
}

.dashboard-card.card-warning .card-icon {
    color: var(--warning-color);
    background-color: rgba(224, 168, 0, 0.1);
}
.dashboard-card.card-warning {
    border-left-color: var(--warning-color);
}


.dashboard-card .card-content h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.1rem; /* Slightly smaller heading */
    color: var(--secondary-color);
    font-weight: 600;
}

.dashboard-card .card-content .stat-number {
    font-size: 2.2rem; /* Larger stat number */
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

/* Responsive adjustments for dashboard cards */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr; /* Single column on smaller screens */
    }
    .dashboard-card {
        flex-direction: column; /* Stack icon and text vertically */
        text-align: center;
    }
    .dashboard-card .card-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }
}


/* Styling for parts/templates.php and similar pages */
.page-title {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

.card {
    background-color: var(--light-color);
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: #f8f9fa;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e0e0e0;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--dark-color);
}

.card-header h3 {
    margin: 0;
    font-size: 1.3rem; /* Adjusted for card header context */
    color: var(--primary-color);
}

.card-body {
    padding: 1.25rem;
}

.table-wrapper {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow-x: auto; /* Responsive tables */
    margin-bottom: 25px;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--dark-color);
    border-collapse: separate;
    border-spacing: 0 8px;
    background: transparent;
}

.table th,
.table td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    background: var(--light-color);
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #e9ecef; /* Light grey header */
    color: var(--dark-color);
    font-weight: 500;
}

.table tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,.03); /* Subtle striping */
}

.table tbody tr:hover td {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.table .action-buttons a {
    margin-left: 5px; /* Spacing between buttons */
}

.table .action-buttons .btn {
    padding: 0.3rem 0.6rem; /* Smaller buttons for table actions */
    font-size: 0.8rem;
}

/* Specific styles for template management page */
#template_body {
    min-height: 150px;
    font-family: 'Courier New', Courier, monospace; /* Monospace for code-like text */
}

.form-text.text-muted code {
    background-color: #e9ecef;
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    border-radius: 3px;
    color: var(--primary-color);
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .page-title {
    margin-bottom: 30px; /* Increased margin */
}

/* Dashboard Grid and Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive grid */
    gap: 25px;
    margin-top: 20px;
}

.dashboard-card {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center; /* Align icon and content */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 5px solid var(--primary-color); /* Accent border */
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.dashboard-card .card-icon {
    font-size: 2.5rem; /* Larger icon */
    margin-right: 20px; /* Space between icon and text */
    color: var(--primary-color);
    width: 60px; /* Fixed width for icon container */
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 86, 179, 0.1); /* Light background for icon */
    border-radius: 50%;
}

.dashboard-card.card-danger .card-icon {
    color: var(--danger-color);
    background-color: rgba(200, 35, 51, 0.1);
}
.dashboard-card.card-danger {
    border-left-color: var(--danger-color);
}

.dashboard-card.card-warning .card-icon {
    color: var(--warning-color);
    background-color: rgba(224, 168, 0, 0.1);
}
.dashboard-card.card-warning {
    border-left-color: var(--warning-color);
}


.dashboard-card .card-content h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.1rem; /* Slightly smaller heading */
    color: var(--secondary-color);
    font-weight: 600;
}

.dashboard-card .card-content .stat-number {
    font-size: 2.2rem; /* Larger stat number */
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

/* Responsive adjustments for dashboard cards */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr; /* Single column on smaller screens */
    }
    .dashboard-card {
        flex-direction: column; /* Stack icon and text vertically */
        text-align: center;
    }
    .dashboard-card .card-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }
}


/* Styling for parts/templates.php and similar pages */
.page-title {
        font-size: 1.5rem;
    }

    .card-header h3 {
        font-size: 1.15rem;
    }

    .table thead {
        display: none; /* Hide table header on small screens, use data attributes if needed */
    }

    .table, .table tbody, .table tr, .table td {
        display: block;
        width: 100%;
    }

    .table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: var(--border-radius);
        box-shadow: 0 2px 3px rgba(0,0,0,0.05);
    }

    .table td {
        text-align: right;
        padding-left: 50%; /* Make space for label */
        position: relative;
        border: none;
        border-bottom: 1px solid #eee;
    }

    .table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        text-align: left;
    }

    .table td:last-child {
        border-bottom: 0;
    }

    .table .action-buttons {
        text-align: center;
        padding-left: 10px; /* Reset padding for action buttons cell */
    }

    .table .action-buttons .btn {
        margin-bottom: 5px;
        display: inline-block; /* Ensure buttons stack nicely if needed */
    }

    .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .d-flex.justify-content-between.align-items-center .btn {
        margin-top: 10px;
    }
}

/* General utility classes that might be useful */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-3 { margin-top: 1rem !important; }

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    left: 0; /* Adjusted for RTL */
    right: auto; /* Adjusted for RTL */
    z-index: 2;
    padding: 1.25rem 1rem;
}

/* Ensure Bootstrap's btn-close is styled if not already */
.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: .25em .25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    border: 0;
    border-radius: .25rem;
    opacity: .5;
}
.btn-close:hover {
    color: #000;
    text-decoration: none;
    opacity: .75;
}
.btn-close:focus {
    outline: 0;
    box-shadow: 0 0 0 .25rem rgba(var(--primary-color-rgb),.25); /* Use primary color for focus */
    opacity: 1;
}


/* Tables */
.table-wrapper {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden; /* For border-radius on table */
    margin-bottom: 25px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--dark-color);
}

.table th, .table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #e9ecef; /* Lighter border */
    vertical-align: middle;
}

.table thead th {
    background-color: #f8f9fa; /* Very light gray for header */
    font-weight: 700;
    color: var(--primary-color);
    border-bottom-width: 2px;
    border-bottom-color: var(--primary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background-color: #f1f3f5;
}

.table td .btn {
    margin-right: 5px;
    margin-bottom: 5px; /* Spacing for multiple buttons */
}

.table .action-buttons a, .table .action-buttons button {
    margin: 0 3px;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.dashboard-card {
    background-image: linear-gradient(135deg, var(--light-color) 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    border-top: 4px solid var(--primary-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-top-color 0.3s ease;
    position: relative;
    overflow: hidden; /* For pseudo-elements if added later */
}

.dashboard-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--box-shadow-lg);
    border-top-color: var(--primary-color-light);
}

.dashboard-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.dashboard-card p.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0;
}

/* Footer */
.dashboard-footer {
    text-align: center;
    padding: 20px;
    background-color: var(--light-color);
    color: var(--secondary-color);
    border-top: 1px solid #dee2e6;
    font-size: var(--font-size-sm);
    margin-top: 30px;
}

/* Modal Styles (Basic) */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--light-color);
    margin: 10% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 15px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
}

.modal-close:hover,
.modal-close:focus {
    color: var(--dark-color);
    text-decoration: none;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.collapsed {
        transform: translateX(0);
    }
    .main-content {
        padding-right: 0;
    }
    .dashboard-header {
        right: 0;
    }
    .hamburger-menu {
        display: block;
        z-index: 1001;
    }
}

@media (max-width: 768px) {
    .page-content h2.page-title {
    margin-bottom: 30px; /* Increased margin */
}

/* Dashboard Grid and Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive grid */
    gap: 25px;
    margin-top: 20px;
}

.dashboard-card {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center; /* Align icon and content */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 5px solid var(--primary-color); /* Accent border */
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.dashboard-card .card-icon {
    font-size: 2.5rem; /* Larger icon */
    margin-right: 20px; /* Space between icon and text */
    color: var(--primary-color);
    width: 60px; /* Fixed width for icon container */
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 86, 179, 0.1); /* Light background for icon */
    border-radius: 50%;
}

.dashboard-card.card-danger .card-icon {
    color: var(--danger-color);
    background-color: rgba(200, 35, 51, 0.1);
}
.dashboard-card.card-danger {
    border-left-color: var(--danger-color);
}

.dashboard-card.card-warning .card-icon {
    color: var(--warning-color);
    background-color: rgba(224, 168, 0, 0.1);
}
.dashboard-card.card-warning {
    border-left-color: var(--warning-color);
}


.dashboard-card .card-content h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.1rem; /* Slightly smaller heading */
    color: var(--secondary-color);
    font-weight: 600;
}

.dashboard-card .card-content .stat-number {
    font-size: 2.2rem; /* Larger stat number */
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

/* Responsive adjustments for dashboard cards */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr; /* Single column on smaller screens */
    }
    .dashboard-card {
        flex-direction: column; /* Stack icon and text vertically */
        text-align: center;
    }
    .dashboard-card .card-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }
}


/* Styling for parts/templates.php and similar pages */
.page-title {
        font-size: 1.5rem;
    }
    .dashboard-grid {
        grid-template-columns: 1fr; /* Stack cards */
    }
    .auth-card {
        padding: 25px 20px;
    }
    .dashboard-header .user-info span {
        display: none; /* Hide username text on small screens, keep logout */
    }
    .table th, .table td {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    .btn {
        padding: 8px 18px;
        font-size: 0.9rem;
    }
    .modal-content {
        width: 90%;
        margin: 15% auto;
    }
}

@media (max-width: 576px) { /* Extra small devices (portrait phones, less than 576px) */
    .page-content {
        padding: 20px;
    }
    .dashboard-header {
        padding: 0 15px;
    }
    .dashboard-header .user-info .btn {
        font-size: var(--font-size-sm);
        padding: 6px 10px;
    }
    .auth-card h2 {
        font-size: 1.3rem;
    }
    .auth-card .form-control, .auth-card .btn-submit {
        font-size: 0.95rem;
    }
}

/* Utility Classes */
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.font-weight-bold { font-weight: 700 !important; }
.font-weight-medium { font-weight: 500 !important; }
.font-weight-normal { font-weight: 400 !important; }

.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }

.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.ml-3 { margin-left: 1rem !important; }

.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mr-3 { margin-right: 1rem !important; }

.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }

.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-block { display: inline-block !important; }
.d-none { display: none !important; }

.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }

.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-baseline { align-items: baseline !important; }
.align-items-stretch { align-items: stretch !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

/* Specific fixes or enhancements */
#group_members_table_wrapper .btn {
    margin-bottom: 5px; /* Ensure buttons in table don't overlap too much */
}

/* Style for action buttons in tables */
.action-buttons a, .action-buttons button {
    margin: 0 3px;
}

/* Hide elements meant for screen readers only or specific states */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 998; /* Below sidebar, above content */
}
.sidebar-overlay.active {
    display: block;
}

/* Custom scrollbar (optional, webkit only) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}