/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
/* ADDED: Import Arabic font */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');


/* --- Custom Properties (Variables) --- */
:root {
    --primary-color: #6a5acd; /* SlateBlue */
    --secondary-color: #2c2f33; /* Near-black */
    --accent-color: #7289da; /* Discord Blurple */
    --success-color: #43b581; /* Discord Green */
    --danger-color: #f04747; /* Discord Red */
    --warning-color: #faa61a; /* Discord Yellow */
    --text-color: #dcddde;
    --text-muted: #96989d;
    --border-radius: 12px;
    --card-bg: rgba(44, 47, 51, 0.7);
    --input-bg: rgba(32, 34, 37, 0.8);
    --input-border: rgba(60, 63, 68, 0.8);
    --hover-glow: 0 0 20px rgba(114, 137, 218, 0.5);
    --backdrop-blur: blur(10px);
}

/* --- Base Styles --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #1a1c20;
    background-image: linear-gradient(to bottom right, #1a1c20, #2c2f33);
    color: #e0e0e0;
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    background-attachment: fixed; 
    background-size: cover;      
}

/* --- Particle Animation Background --- */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

#particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0.4;
    animation: float 6s ease-in-out infinite;
}

/* --- Layout & Containers --- */
.container {
    max-width: 1200px;
    padding: 1rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* --- Navbar --- */
.navbar {
    background-color: rgba(32, 34, 37, 0.6);
    border-bottom: 1px solid var(--input-border);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--accent-color);
    transition: text-shadow 0.3s ease;
}
.navbar-brand:hover {
    text-shadow: 0 0 10px var(--accent-color);
}
.navbar-nav .nav-link {
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s ease;
}
.navbar-nav .nav-link:hover, .navbar-nav .nav-link.active {
    color: #fff;
}
.dropdown-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--input-border);
    backdrop-filter: var(--backdrop-blur);
    border-radius: var(--border-radius);
}
.dropdown-item {
    color: var(--text-color);
}
.dropdown-item:hover {
    background-color: var(--accent-color);
    color: #fff;
}

/* --- Cards --- */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
}
.card-title {
    font-weight: 600;
    color: #fff;
}

/* --- Buttons --- */
.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    transition: all 0.2s ease-in-out;
    border: none;
}
.btn-primary {
    background-color: var(--accent-color);
    color: #fff;
    box-shadow: 0 4px 15px -5px rgba(114, 137, 218, 0.7);
}
.btn-primary:hover {
    background-color: #677bc4;
    box-shadow: var(--hover-glow);
    transform: translateY(-2px);
}

/* --- Forms --- */
.form-control, .form-select {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    border-radius: 8px;
    padding: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control:focus, .form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(114, 137, 218, 0.6);
}

.role-list-container {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background-color: var(--input-bg);
    padding: 8px;
}
.role-option {
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}
.role-option:hover {
    background-color: rgba(114, 137, 218, 0.1);
}

/* --- Tabs on Manage Page --- */
.nav-tabs {
    border-bottom: 1px solid var(--input-border);
}
.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    background-color: transparent;
    margin-right: 5px;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
}
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
    color: #fff;
    background-color: var(--card-bg);
    border-bottom-color: var(--accent-color);
}
.tab-content .card {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
}

/* --- Tables --- */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-color);
    --bs-table-border-color: var(--input-border);
    --bs-table-hover-bg: rgba(54, 57, 63, 0.7);
    --bs-table-striped-bg: rgba(44, 47, 51, 0.3);
}
.table th {
    background-color: rgba(32, 34, 37, 0.8);
    color: #fff;
    border-bottom-width: 2px;
}
.table td { vertical-align: middle; }
.table a { color: var(--accent-color); text-decoration: none; font-weight: 500; }
.table a:hover { text-decoration: underline; }

/* --- Server Grid on Dashboard Page --- */
.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}
.server-card {
    background: linear-gradient(145deg, var(--secondary-color), #1e2124);
    border-color: var(--input-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.server-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 0 25px rgba(114, 137, 218, 0.5), 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-color);
}
.card-img-container { width: 100%; aspect-ratio: 16 / 9; position: relative; overflow: hidden; }
.card-img-top { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; border-bottom: 1px solid var(--input-border); transition: transform 0.4s ease; }
.server-card:hover .card-img-top { transform: scale(1.1); }
.card-body { padding: 1.5rem; display: flex; flex-direction: column; flex-grow: 1; }
.card-text { flex-grow: 1; }

/* --- Accordion on Manage Page --- */
.accordion-item {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--input-border) !important;
    border-radius: var(--border-radius) !important;
}
.accordion-button {
    background-color: var(--input-bg) !important;
    color: var(--text-color) !important;
    font-weight: 600;
}
.accordion-button:not(.collapsed) {
    box-shadow: inset 0 -1px 0 var(--input-border);
}
.accordion-button:focus {
    box-shadow: 0 0 0 .25rem rgba(var(--accent-color), .25);
    border-color: var(--accent-color);
}

/* --- Live Embed Preview --- */
.discord-embed-preview {
    background-color: #2f3136;
    border-radius: 8px;
    padding: 8px 16px 16px 8px;
    display: flex;
    font-size: 0.875rem;
    line-height: 1.375rem;
    max-width: 520px;
    position: relative;
    border: 1px solid var(--input-border);
}
.embed-color-bar {
    background-color: var(--accent-color);
    width: 4px;
    border-radius: 4px 0 0 4px;
    flex-shrink: 0;
}
.embed-content {
    padding-left: 12px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.embed-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.embed-author-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: cover;
}
.embed-author-name {
    font-weight: 500;
    color: #fff;
}
.embed-body {
    display: flex;
}
.embed-main-content {
    flex-grow: 1;
}
.embed-title {
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    display: block;
}
.embed-description {
    color: var(--text-color);
    white-space: pre-wrap;
    word-break: break-word;
}
.embed-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-left: 16px;
    flex-shrink: 0;
    display: none; /* Hidden by default */
}
.embed-image {
    max-width: 100%;
    height: auto;
    margin-top: 16px;
    border-radius: 4px;
    display: none; /* Hidden by default */
}
.embed-footer {
    display: flex;
    align-items: center;
    margin-top: 8px;
}
.embed-footer-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: cover;
}
.embed-footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* --- Additions for manage.ejs redesign --- */

.guild-header-card {
    background: linear-gradient(45deg, var(--secondary-color), #36393f);
    border-color: var(--input-border) !important;
}

.card-tab-content {
    border-top-left-radius: 0 !important;
}

.border-dashed {
    border: 2px dashed var(--input-border) !important;
}

.accordion-item {
    background-color: transparent !important;
    border: 1px solid var(--input-border) !important;
    border-radius: var(--border-radius) !important;
}
.accordion-header {
    background-color: var(--input-bg);
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease;
}
.accordion-item:has(.accordion-button:not(.collapsed)) .accordion-header {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    background-color: rgba(44, 47, 51, 0.9);
}
.accordion-button {
    background-color: transparent !important;
    color: var(--text-color) !important;
}
.accordion-button:not(.collapsed) {
    box-shadow: none;
    color: #fff !important;
}
.accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}
.accordion-body {
    background-color: var(--card-bg);
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.table thead {
    position: sticky;
    top: 0;
}
.table td, .table th {
    white-space: nowrap;
}
.table td .badge {
    font-weight: 600;
    font-size: 0.8rem;
}

/* --- RTL Overrides --- */
html[dir="rtl"] {
    direction: rtl;
}

html[dir="rtl"] body {
    text-align: right;
    font-family: 'Tajawal', 'Inter', sans-serif;
}

/* Navbar */
html[dir="rtl"] .navbar-brand {
    margin-right: 0;
    margin-left: 1rem;
}
html[dir="rtl"] .navbar-nav {
    padding-right: 0;
}
html[dir="rtl"] .navbar-collapse .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}
html[dir="rtl"] .ms-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}
html[dir="rtl"] .me-1 { margin-left: .25rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-2 { margin-left: .5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .me-3 { margin-left: 1rem !important; margin-right: 0 !important; }
html[dir="rtl"] .ms-1 { margin-right: .25rem !important; margin-left: 0 !important; }
html[dir="rtl"] .ms-2 { margin-right: .5rem !important; margin-left: 0 !important; }

html[dir="rtl"] .rounded-circle.me-2 {
    margin-left: .5rem !important;
    margin-right: 0 !important;
}
html[dir="rtl"] .dropdown-menu {
    text-align: right;
}
html[dir="rtl"] .dropdown-menu-end {
    --bs-position: start;
}
html[dir="rtl"] .dropdown-toggle::after {
    margin-left: 0;
    margin-right: 0.255em;
}
html[dir="rtl"] .bi-arrow-right-short::before {
    content: "\f128"; /* Bootstrap icon for arrow-left-short */
}
html[dir="rtl"] .bi-arrow-left::before {
    content: "\f12d"; /* Bootstrap icon for arrow-right */
}
html[dir="rtl"] .bi-box-arrow-right::before {
    content: "\f18d"; /* Bootstrap icon for box-arrow-left */
}

/* Landing Page Hero */
html[dir="rtl"] .flex-lg-row-reverse {
    flex-direction: row !important;
}

/* Forms & Inputs */
html[dir="rtl"] .form-check {
    padding-right: 1.5em;
    padding-left: 0;
}
html[dir="rtl"] .form-check .form-check-input {
    float: right;
    margin-right: -1.5em;
    margin-left: 0;
}
html[dir="rtl"] .input-group {
    direction: ltr;
}
html[dir="rtl"] .input-group > :not(:first-child) {
    border-top-left-radius: var(--bs-border-radius);
    border-bottom-left-radius: var(--bs-border-radius);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
html[dir="rtl"] .input-group > :not(:last-child) {
    border-top-right-radius: var(--bs-border-radius);
    border-bottom-right-radius: var(--bs-border-radius);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
html[dir="rtl"] .input-group > .form-control,
html[dir="rtl"] .input-group > .form-select {
    direction: rtl;
}
html[dir="rtl"] .role-checkbox {
    left: 10px;
    right: auto;
}

/* Tables */
html[dir="rtl"] .table {
    text-align: right;
}

/* Accordion */
html[dir="rtl"] .accordion-button::after {
    margin-left: auto;
    margin-right: 0;
}

/* Modals */
html[dir="rtl"] .modal-header .btn-close {
    margin-left: auto;
    margin-right: -.5rem;
}
html[dir="rtl"] .modal-footer {
    justify-content: flex-start;
}

/* Embed Preview */
html[dir="rtl"] .embed-content {
    padding-right: 12px;
    padding-left: 0;
}
html[dir="rtl"] .embed-author-icon {
    margin-left: 8px;
    margin-right: 0;
}
html[dir="rtl"] .embed-thumbnail {
    margin-right: 16px;
    margin-left: 0;
}
html[dir="rtl"] .embed-footer-icon {
    margin-left: 8px;
    margin-right: 0;
}
html[dir="rtl"] .embed-color-bar {
    border-radius: 0 4px 4px 0;
}

/* --- Additions for index.ejs redesign --- */

/* Features Section */
.feature-icon {
    width: 3rem;
    height: 3rem;
    border-radius: .75rem;
}

/* How It Works Cards */
.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Testimonials */
.testimonial-card {
    height: 100%;
}

/* Call to Action */
.cta-section {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--border-radius);
    padding: 3rem 1rem;
}

/* General Alignment */
html[dir="rtl"] .text-end {
    text-align: left !important;
}
html[dir="rtl"] .text-start {
    text-align: right !important;
}
html[dir="rtl"] .justify-content-md-start {
    justify-content: flex-end !important;
}
html[dir="rtl"] .nav-tabs .nav-link {
    margin-left: 5px;
    margin-right: 0;
}
html[dir="rtl"] .card-tab-content {
    border-top-right-radius: 0 !important;
    border-top-left-radius: var(--bs-border-radius) !important;
}

/* Footer Styles */
.footer {
    background: linear-gradient(135deg, var(--secondary-color), #1a1c20);
    border-top: 1px solid #40444B;
}

.footer a {
    transition: all 0.3s ease;
}

.footer a:hover {
    color: #fff !important;
    transform: translateX(3px);
}

.hover-highlight:hover {
    color: var(--accent-color) !important;
}

.hover-fade:hover {
    opacity: 0.7;
    transform: scale(1.1);
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.footer h5 {
    color: #fff;
    position: relative;
    margin-bottom: 1.5rem;
}

.footer h5::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 3px;
}

.form-control {
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-color);
}

.btn-primary {
    background-color: var(--accent-color);
    border: none;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #5a6fd1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(114, 137, 218, 0.4);
}

.footer-links a {
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--accent-color) !important;
    text-decoration: underline;
}
/* Admin Global Styles */
:root {
    --glass-bg: rgba(30, 33, 36, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
}

.admin-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.admin-card:last-child {
    margin-bottom: 0;
}

/* Add spacing between admin cards in adjacent columns */
.col-lg-8 .admin-card,
.col-lg-4 .admin-card {
    margin-right: 1rem;
}

@media (max-width: 992px) {
    .col-lg-8 .admin-card,
    .col-lg-4 .admin-card {
        margin-right: 0;
    }
}

.admin-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.table-glass {
    --bs-table-bg: transparent;
    --bs-table-color: #dcddde;
    --bs-table-border-color: var(--glass-border);
}

.table-glass th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #96989d;
    border-bottom-width: 1px;
}

.table-glass td {
    vertical-align: middle;
    padding: 1rem 0.75rem;
}

.bg-gradient-primary { background: linear-gradient(135deg, rgba(88, 101, 242, 0.2) 0%, rgba(32, 34, 37, 0.5) 100%); border-left: 4px solid #5865F2; }
.bg-gradient-success { background: linear-gradient(135deg, rgba(87, 242, 135, 0.2) 0%, rgba(32, 34, 37, 0.5) 100%); border-left: 4px solid #57F287; }
.bg-gradient-warning { background: linear-gradient(135deg, rgba(254, 231, 92, 0.2) 0%, rgba(32, 34, 37, 0.5) 100%); border-left: 4px solid #FEE75C; }
.bg-gradient-info { background: linear-gradient(135deg, rgba(235, 69, 158, 0.2) 0%, rgba(32, 34, 37, 0.5) 100%); border-left: 4px solid #EB459E; }

/* Admin Sidebar Styles */
.admin-container {
    display: flex;
    min-height: calc(100vh - 70px);
    background: linear-gradient(135deg, #1a1c20, #2c2f33);
}

.admin-sidebar {
    width: 260px;
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
    height: calc(100vh - 80px);
    position: fixed;
    top: 80px;
    left: 0;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    z-index: 9999;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.admin-sidebar-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.nav-category {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 1.5rem 0 0.5rem 0;
    letter-spacing: 0.5px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    border-radius: 8px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-link.active {
    background: rgba(114, 137, 218, 0.15);
    color: var(--accent-color);
    border-left: 3px solid var(--accent-color);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.admin-content {
    flex: 1;
    padding: 2rem;
    margin-left: 260px;
}

.admin-content-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

@media (max-width: 992px) {
    .admin-sidebar {
        width: 80px;
    }
    
    .admin-sidebar .nav-category,
    .admin-sidebar .nav-link span {
        display: none;
    }
    
    .admin-sidebar .nav-link {
        justify-content: center;
        padding: 0.75rem;
    }
    
    .admin-sidebar .nav-link i {
        margin-right: 0;
        font-size: 1.2rem;
    }
    
    .admin-content {
        margin-left: 80px;
    }
}

/* Admin Form Styles */
.form-control {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
}

.form-control:focus {
    background: var(--input-bg);
    border-color: var(--accent-color);
    color: var(--text-color);
}

.form-select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
}

/* Admin Progress Bars */
.progress {
    background: var(--input-bg);
}

/* Admin List Groups */
.list-group-item {
    background: transparent !important;
    border: 1px solid var(--glass-border) !important;
}