/* --- GLOBAL VARIABLES --- */
:root {
    --primary-color: #60a917; /* The new green from your logo */
    --primary-hover: #4d8a13; /* A darker shade for hover states */
    --secondary-color: #0056b3; /* A professional blue for accents/links */
    --sidebar-bg: #2c3e50;
    --bg-light: #f4f6f8;
    --text-dark: #333;
    --text-light: #666;
    --danger-color: #dc3545;
    --danger-hover: #c82333;
    --success-color: #28a745;
    --success-hover: #218838;
}

body { margin: 0; font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: var(--bg-light); height: 100vh; display: flex; flex-direction: column; color: var(--text-dark); }

/* --- LOGIN PAGE STYLES --- */
#login-view {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; display: none; 
}
.logo-container { margin-bottom: 40px; text-align: center; }
.logo-container img { width: 400px; height: auto; }

.login-card {
    background: white; padding: 40px; border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 300px;
    display: flex; flex-direction: column; gap: 15px;
}

button {
    padding: 12px; border: none; border-radius: 4px;
    cursor: pointer; font-size: 16px; transition: background 0.2s; font-weight: 500;
}
/* Updated Login Buttons to match brand or be neutral */
.btn-email { background-color: var(--primary-color); color: white; }
.btn-email:hover { background-color: var(--primary-hover); }

.btn-google { background-color: #db4437; color: white; }
.btn-apple { background-color: #000; color: white; }
button:hover { opacity: 0.9; }
input { padding: 10px; border: 1px solid #ddd; border-radius: 4px; }

/* --- DASHBOARD STYLES --- */
#dashboard-view { display: flex; height: 100vh; display: none; }

.sidebar {
    width: 250px; background-color: var(--sidebar-bg); color: white;
    display: flex; flex-direction: column; padding-top: 20px; flex-shrink: 0;
}
.sidebar h2 { text-align: center; margin-bottom: 30px; font-size: 1.2rem; font-weight: 400; letter-spacing: 1px; }
.nav-btn {
    background: none; color: #bdc3c7; text-align: left;
    padding: 15px 25px; font-size: 18px; border-left: 4px solid transparent;
}
/* Updated active/hover state to use the new green */
.nav-btn:hover, .nav-btn.active {
    background-color: rgba(255,255,255,0.1); color: white; 
    border-left-color: var(--primary-color);
}
.main-content { flex: 1; padding: 40px; overflow-y: auto; }

/* --- DATA TABLE STYLES (Clients & Reports) --- */
.toolbar { display: flex; justify-content: space-between; margin-bottom: 20px; }
.search-bar { padding: 10px; width: 300px; border: 1px solid #ddd; border-radius: 4px; }
.data-table {
    width: 100%; border-collapse: collapse; background: white;
    border-radius: 8px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.data-table th, .data-table td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; }
.data-table th { background-color: #f8f9fa; font-weight: 600; color: #555; text-transform: uppercase; font-size: 0.85rem; }
.data-table tr:hover { background-color: #f1f7ff; cursor: pointer; }

/* Tag Badges (Display Mode) */
.tag-badge {
    background-color: #e2e8f0; color: #4a5568; padding: 4px 8px;
    border-radius: 12px; font-size: 0.75rem; margin-right: 4px; display: inline-block;
}
.tag-badge.vip { background-color: #fed7d7; color: #c53030; } 
.tag-badge.donor { background-color: #c6f6d5; color: #2f855a; } 

/* Primary Button (Used for 'Add Client') */
.btn-primary {
    background-color: var(--primary-color); color: white; border: none;
    padding: 10px 20px; border-radius: 4px; cursor: pointer;
}
.btn-primary:hover { background-color: var(--primary-hover); }

/* --- PAGINATION STYLES --- */
.pagination-container {
    display: flex; justify-content: center; align-items: center;
    margin-top: 20px; gap: 15px;
}
/* Updated pagination buttons to use the green */
.page-btn {
    background: white; border: 1px solid var(--primary-color); color: var(--primary-color);
    padding: 8px 16px; border-radius: 4px; cursor: pointer; font-weight: 500; user-select: none;
}
.page-btn:hover { background-color: var(--primary-color); color: white; }
.page-btn:disabled { color: #ccc; border-color: #ccc; cursor: not-allowed; background: #f9f9f9; }
.page-info { color: var(--text-light); font-size: 0.9rem; }

/* --- CLIENT DETAIL FORM STYLES --- */
.detail-header {
    display: flex; align-items: center; margin-bottom: 20px;
    border-bottom: 1px solid #eee; padding-bottom: 15px;
}
.back-btn {
    background: none; border: 1px solid #ddd; border-radius: 4px;
    padding: 8px 12px; margin-right: 15px; cursor: pointer; font-size: 0.9rem; color: var(--text-light);
}
.back-btn:hover { border-color: var(--text-dark); color: var(--text-dark); }

.form-card {
    background: white; padding: 30px; border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { display: flex; flex-direction: column; margin-bottom: 15px; }
.form-group label {
    font-size: 0.85rem; font-weight: 600; color: #555;
    margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group input, .form-group select {
    padding: 10px; border: 1px solid #ddd; border-radius: 4px;
    font-size: 1rem; background-color: #fafafa; color: var(--text-dark);
}
/* Focus state uses the new green */
.form-group input:focus, .form-group select:focus {
    border-color: var(--primary-color); background-color: #fff; outline: none;
}
.full-width { grid-column: span 2; }
.action-bar {
    margin-top: 30px; display: flex; justify-content: flex-end;
    gap: 10px; border-top: 1px solid #eee; padding-top: 20px;
}
/* Save button uses success green */
.btn-save { background-color: var(--success-color); color: white; border: none; padding: 12px 30px; border-radius: 4px; cursor: pointer; font-size: 1rem; }
.btn-save:hover { background-color: var(--success-hover); }
.btn-cancel { background-color: white; border: 1px solid #ccc; color: #333; padding: 12px 20px; border-radius: 4px; cursor: pointer; }
/* Delete button uses danger red */
.btn-delete {
    background-color: var(--danger-color); color: white; border: none; 
    padding: 12px 20px; border-radius: 4px; cursor: pointer; margin-right: auto;
}
.btn-delete:hover { background-color: var(--danger-hover); }


/* --- TAG MANAGEMENT STYLES --- */
.tag-container-edit {
    display: flex; flex-wrap: wrap; gap: 8px; padding: 10px;
    border: 1px solid #ddd; border-radius: 4px; background-color: #fafafa;
    min-height: 42px; box-sizing: border-box;
}
.edit-tag-pill {
    background-color: #e2e8f0; color: #2d3748; padding: 6px 12px;
    border-radius: 16px; font-size: 0.85rem; cursor: context-menu;
    border: 1px solid #cbd5e0; user-select: none;
}
.edit-tag-pill:hover { background-color: #cbd5e0; color: var(--danger-color); border-color: #feb2b2;}
/* Add Tag button uses the new green */
.btn-add-tag {
    background: var(--primary-color); color: white; border: none;
    width: 24px; height: 24px; border-radius: 50%;
    font-size: 18px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    margin-left: 10px; padding: 0; padding-bottom: 2px;
}
.btn-add-tag:hover { background: var(--primary-hover); }

/* Modal Popup */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: none; justify-content: center; align-items: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: white; padding: 25px; border-radius: 8px;
    width: 400px; max-height: 80vh; display: flex; flex-direction: column;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.modal-header { font-size: 1.2rem; font-weight: 600; margin-bottom: 15px; color: var(--primary-color); }
.modal-body { flex: 1; overflow-y: auto; margin-bottom: 20px; border: 1px solid #eee; padding: 10px; border-radius: 4px;}
.checkbox-item { display: flex; align-items: center; padding: 8px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.checkbox-item:hover { background-color: #f9f9f9; }
.checkbox-item:last-child { border-bottom: none; }
.checkbox-item input { margin-right: 10px; accent-color: var(--primary-color); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* --- MAILING TABS --- */
.tab-btn {
    background: none; border: none; font-size: 1.1rem; 
    color: #888; cursor: pointer; padding-bottom: 5px;
    border-bottom: 3px solid transparent;
}
.tab-btn:hover { color: var(--primary-color); }
.active-tab {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    font-weight: 600;
}

/* --- EMAIL PREVIEW MODAL --- */
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    justify-content: center; align-items: center;
}

.modal-content {
    background: white; width: 80%; max-width: 800px; height: 80%;
    padding: 20px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
}

.preview-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #ddd; padding-bottom: 10px; margin-bottom: 10px;
}

.preview-body {
    flex: 1; overflow-y: auto; padding: 15px; border: 1px dashed #ccc; background: #f9f9f9;
}

/* Fix for Quill Editor height */
#editor-container {
    height: 300px;
}

/* --- TOGGLE SWITCH STYLES --- */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  margin-right: 15px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

/* When Checked (Blue) */
input:checked + .slider {
  background-color: #2196F3;
}

/* Move the circle when checked */
input:checked + .slider:before {
  transform: translateX(24px);
}

/* Warning Color for Test Mode (Orange) */
input.test-mode-toggle:checked + .slider {
  background-color: #f0ad4e;
}

/* Lists */
.client-card, .list-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.client-card:hover, .list-item:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Tabs */
.tab-container {
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}
.tab-btn {
    background: none;
    color: #666;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding-bottom: 10px;
    font-weight: bold;
}
.tab-btn.active {
    color: #007bff;
    border-bottom: 3px solid #007bff;
}
/* Utility */
.hidden { display: none !important; }

/* --- CLIENT TAB STYLES --- */
.tab-container {
    display: flex;
    border-bottom: 1px solid #dee2e6; /* The line the tabs sit on */
    margin-bottom: 20px;
    padding-left: 10px;
    gap: 5px; /* Spacing between tabs */
}

.tab-btn {
    padding: 10px 20px;
    background-color: #f1f3f5; /* Darker background for inactive tabs */
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 6px 6px 0 0; /* Rounded top corners */
    color: #666;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    margin-bottom: -1px; /* Pushes button down to cover the bottom line */
}

.tab-btn:hover {
    background-color: #e9ecef; /* Slightly darker on hover */
    color: #333;
}

.tab-btn.active {
    background-color: #ffffff; /* White background for active tab */
    color: #007bff; /* Blue text */
    font-weight: bold;
    border-top: 3px solid #007bff; /* Blue highlight on top */
    border-bottom: 1px solid #ffffff; /* Hide bottom border to merge with content */
    z-index: 1; /* Ensure it sits on top of the line */
}