/* --- Basic Setup & Variables --- */
:root {
    --brand-color: #7a2532;
    --brand-hover: #5a1c25;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --green: #10b981;
    --blue: #3b82f6;
    --orange: #f97316;
    --red: #ef4444;
    --white: #ffffff;
    --font-family-sans-serif: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --border-radius: 0.375rem;
}
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- General --- */
body {
    font-family: var(--font-family-sans-serif);
    background-color: var(--gray-50);
    color: var(--gray-800);
    margin: 0;
    font-size: 16px;
}
.app-layout { display: flex; min-height: 100vh; }
.main-content { flex-grow: 1; padding: 2rem; }

/* --- Sidebar Navigation --- */
.sidebar {
    width: 260px;
    background-color: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    text-align: center;
}
.logo {
    height: 40px;  /* Fixed height for desktop */
    width: auto;   /* Auto width to maintain aspect ratio */
    max-width: 100%;
}
.nav-menu { list-style: none; margin: 0; padding: 1rem; }
.nav-menu a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.nav-menu a:hover { background-color: var(--gray-100); color: var(--gray-800); }
.nav-menu a.active { background-color: var(--brand-color); color: var(--white); }
.sidebar-footer { margin-top: auto; padding: 1rem; }

/* --- Header --- */
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.header h1 { margin: 0; font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* --- Buttons & Forms --- */
.btn {
    display: inline-block; font-weight: 600; color: var(--white); text-align: center;
    cursor: pointer; background-color: var(--brand-color); border: 1px solid transparent;
    padding: 0.5rem 1rem; font-size: 0.875rem; border-radius: var(--border-radius);
    text-decoration: none; transition: all 0.2s ease-in-out;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background-color: var(--gray-600); }
.btn-danger { background-color: var(--red); }
.btn-warning { background-color: var(--orange); }

.card {
    background-color: var(--white); border: 1px solid var(--gray-200);
    border-radius: var(--border-radius); box-shadow: var(--shadow-sm);
}
.card-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-200); font-weight: 600; }
.card-body { padding: 1.5rem; }

.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.875rem; }
.form-control {
    display: block; width: 100%; padding: 0.5rem; font-size: 1rem;
    border: 1px solid var(--gray-200); border-radius: 0.375rem; box-sizing: border-box;
}
.form-control:focus { border-color: var(--brand-color); outline: 0; box-shadow: 0 0 0 3px rgba(122, 37, 50, 0.15); }
.manual-queue-form { display: flex; gap: 0.5rem; align-items: center; }
.manual-queue-form .form-control { width: 70px; }

/* --- Table & Status --- */
.client-table { width: 100%; border-collapse: collapse; }
.client-table th, .client-table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--gray-200); vertical-align: middle;}
.client-table th { font-weight: 600; color: var(--gray-400); font-size: 0.75rem; text-transform: uppercase; }
.actions-cell { display: flex; gap: 0.5rem; }
.actions-cell .btn { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

.status {
    padding: 0.25em 0.6em; border-radius: 1em; font-size: 0.8em;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.status-sent { background-color: var(--green); color: white; }
.status-not-sent { background-color: var(--gray-200); color: var(--gray-800); }
.status-queued { background-color: var(--blue); color: white; }
.status-failed { background-color: var(--red); color: white; }

/* --- Toasts --- */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1050; }
.toast {
    padding: 1rem 1.5rem; border-radius: var(--border-radius); box-shadow: var(--shadow-md);
    opacity: 0; transform: translateY(20px); transition: all 0.3s ease-in-out; margin-top: 1rem;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background-color: var(--green); color: white; }
.toast.error { background-color: var(--red); color: white; }

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; flex-direction: row; align-items: center; justify-content: space-between; }
    .sidebar-footer { display: none; }
    .nav-menu { display: flex; }
    .header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .main-content, .sidebar-header { padding: 1rem; }
    .logo { height: 32px; /* Smaller logo for mobile */ }
}
/* --- Add these new styles to the end of your file --- */

/* --- Pagination --- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
}
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}
.page-item .page-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--brand-color);
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.page-item:first-child .page-link {
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
}
.page-item:last-child .page-link {
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}
.page-item.active .page-link {
    z-index: 3;
    color: var(--white);
    background-color: var(--brand-color);
    border-color: var(--brand-color);
}
.page-item.disabled .page-link {
    color: var(--gray-400);
    pointer-events: none;
    background-color: var(--gray-100);
}
.page-item:not(.active) .page-link:hover {
    background-color: var(--gray-100);
}

/* --- Loading Spinner --- */
.loader {
    text-align: center;
    padding: 2rem;
    font-weight: 500;
    color: var(--gray-400);
}

/* --- Add this new style to the end of your file --- */

.test-mail-form .form-control {
    max-width: 350px; /* Sets a reasonable max width for the email input */
}
* --- Checkbox Column --- */
.client-table th:first-child, .client-table td:first-child {
    width: 1%;
    text-align: center;
}
.client-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* --- System Status Alert --- */
.system-status-alert {
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.system-status-alert.status-ok {
    background-color: #d1fae5; color: #065f46;
}
.system-status-alert.status-warning {
    background-color: #fee2e2; color: #991b1b;
}

/* --- Modal for Preview --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background-color: var(--white);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}
.modal-overlay.visible .modal-content {
    transform: scale(1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { margin: 0; }
.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
}
.modal-body {
    padding: 0;
    overflow-y: auto;
}
.modal-body iframe {
    width: 100%;
    height: 65vh;
    border: none;
}