/* Wellness Club by Greenfield - Branding & UX */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Brand colors */
  --green: #00704a;
  --green-hover: #005a3b;
  --green-light: rgba(0, 112, 74, 0.08);
  --orange: #f78d2b;
  --orange-hover: #e67d1a;
  --orange-light: rgba(247, 141, 43, 0.1);

  /* Backgrounds */
  --bg: #ffffff;
  --bg-page: #f8f9fa;
  --bg-card: #ffffff;
  --bg-input: #f5f5f5;

  /* Text */
  --text: #1a2e2a;
  --text-muted: #6b7280;
  --text-light: #9ca3af;

  /* Borders */
  --border: #e5e7eb;
  --border-focus: var(--green);

  /* Status */
  --success: #059669;
  --error: #dc2626;
  --success-bg: rgba(5, 150, 105, 0.1);
  --error-bg: rgba(220, 38, 38, 0.1);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* Login */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--green) 0%, #005a3b 100%);
}

.login-card {
  background: var(--bg-card);
  padding: 2.5rem;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 1rem;
}

.login-logo img {
  height: 56px;
  width: auto;
}

.login-card h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.login-card input {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-light);
}

.login-card input::placeholder {
  color: var(--text-light);
}

.login-card button {
  width: 100%;
  padding: 0.875rem;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.login-card button:hover {
  background: var(--orange-hover);
}

.error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.twofa-prompt {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

#login-2fa-code {
  font-size: 1.5rem;
  letter-spacing: 0.5em;
  text-align: center;
}

.twofa-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.twofa-actions button {
  flex: 1;
}

.login-sent-msg {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.login-sent-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

#login-sent-back {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

#login-sent-back:hover {
  background: var(--green-light);
}

/* Dashboard */
#dashboard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo img {
  height: 40px;
  width: auto;
}

.header-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.header-logo-text .brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green);
}

.header-logo-text .by {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.header-logo-text .app-name {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#user-email {
  color: var(--text-muted);
  font-size: 0.9rem;
}

#logout-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

#logout-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-input);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 0.875rem 1.25rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s, border-color 0.2s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

/* Main content */
main {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.tab-content {
  display: none;
}

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

/* Section headers */
.tab-content h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.tab-content > p,
.templates-header p,
.scheduled-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg-card);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--green);
  background: var(--green-light);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.upload-zone .hint {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.format-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* Manual import */
.manual-import-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.manual-import-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.manual-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.manual-template-select {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.manual-template-select label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
}

.manual-template-select input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  cursor: pointer;
}

.manual-import-section textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.manual-import-section textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-light);
}

.manual-import-section textarea::placeholder {
  color: var(--text-light);
}

.manual-import-section button {
  padding: 0.625rem 1.25rem;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.manual-import-section button:hover {
  background: var(--orange-hover);
}

#import-result {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
}

#import-result.success {
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: var(--success);
}

#import-result.error {
  background: var(--error-bg);
  border: 1px solid var(--error);
  color: var(--error);
}

/* Templates */
.templates-header {
  margin-bottom: 1.5rem;
}

.templates-header h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.templates-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.template-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.template-card .info h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.template-card .info p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.template-card .info p.template-meta {
  font-size: 0.8rem;
  color: var(--green);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.template-card .actions {
  display: flex;
  gap: 0.5rem;
}

.template-card button {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.btn-edit {
  background: var(--bg-input);
  color: var(--text);
}

.btn-edit:hover {
  background: var(--green-light);
  color: var(--green);
}

.btn-delete {
  background: var(--error-bg);
  color: var(--error);
}

.btn-delete:hover {
  background: rgba(220, 38, 38, 0.2);
}

#add-template-btn {
  margin-top: 1rem;
  padding: 0.625rem 1.25rem;
  background: var(--bg-card);
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}

#add-template-btn:hover {
  background: var(--green);
  color: white;
}

/* Scheduled emails */
.scheduled-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.scheduled-header h2 {
  font-size: 1.35rem;
  font-weight: 600;
}

.filter-buttons {
  display: flex;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.5rem 0.875rem;
  font-size: 0.85rem;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.filter-btn.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.scheduled-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  box-shadow: var(--shadow-sm);
}

.scheduled-item.status-sent {
  border-left: 4px solid var(--success);
}

.scheduled-item.status-failed {
  border-left: 4px solid var(--error);
}

.scheduled-item.status-pending {
  border-left: 4px solid var(--green);
}

.scheduled-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.scheduled-email {
  font-weight: 500;
}

.scheduled-name {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.scheduled-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.scheduled-details .error-msg {
  color: var(--error);
}

.scheduled-meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.status-sent {
  background: var(--success-bg);
  color: var(--success);
}

.status-badge.status-failed {
  background: var(--error-bg);
  color: var(--error);
}

.status-badge.status-pending {
  background: var(--green-light);
  color: var(--green);
}

.status-badge.status-cancelled {
  background: var(--bg-input);
  color: var(--text-muted);
}

.scheduled-item.status-cancelled {
  border-left-color: var(--text-muted);
}

.btn-cancel-batch {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  background: transparent;
  color: var(--error);
  border: 1px solid rgba(220, 38, 38, 0.5);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.btn-cancel-batch:hover:not(:disabled) {
  background: var(--error-bg);
}

.btn-cancel-batch:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.scheduled-import {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Grupare import -> client -> emailuri */
.scheduled-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.scheduled-group-header {
  padding: 0.875rem 1.25rem;
  background: var(--green);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.scheduled-group-filename {
  font-weight: 600;
  font-size: 0.95rem;
}

.scheduled-group-date {
  font-size: 0.85rem;
  opacity: 0.9;
}

.scheduled-client-group {
  border-bottom: 1px solid var(--border);
}

.scheduled-client-group:last-child {
  border-bottom: none;
}

.scheduled-client-header {
  padding: 0.75rem 1rem;
  background: var(--green-light);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.scheduled-client-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.scheduled-client-header .scheduled-email {
  font-weight: 500;
  font-size: 0.9rem;
}

.scheduled-client-header .scheduled-name {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.scheduled-client-emails {
  padding: 0.5rem;
}

.scheduled-subitem {
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.75rem !important;
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.scheduled-subitem:last-child {
  margin-bottom: 0;
}

.scheduled-subitem .scheduled-main {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}

.scheduled-subitem .scheduled-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.scheduled-template {
  font-weight: 500;
}

.scheduled-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-send-now {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-left: auto;
  font-weight: 600;
}

.btn-send-now:hover:not(:disabled) {
  background: var(--orange-hover);
}

.btn-send-now:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* History */
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.history-item h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.history-item .meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.75rem;
  width: 100%;
  max-width: 500px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.modal-content h3 {
  margin-bottom: 1.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.modal-content label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-content input:focus,
.modal-content textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-light);
}

.modal-content textarea {
  resize: vertical;
  font-family: inherit;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.modal-actions button {
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

#modal-cancel {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

#modal-cancel:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.modal-actions button[type="submit"] {
  background: var(--orange);
  color: white;
  border: none;
}

.modal-actions button[type="submit"]:hover {
  background: var(--orange-hover);
}

.secondary {
  background: var(--bg-input) !important;
  color: var(--text) !important;
}

/* Account / 2FA */
.account-section {
  max-width: 400px;
}

.account-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.account-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.account-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 1rem 0 0.5rem;
}

.account-section code {
  display: block;
  padding: 0.5rem;
  background: var(--bg-input);
  border-radius: 6px;
  font-size: 0.8rem;
  word-break: break-all;
  margin-bottom: 1rem;
}

.account-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.account-actions button,
#account-2fa-disable-btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

.qr-code {
  max-width: 200px;
  height: auto;
  margin: 1rem 0;
}

.status-enabled {
  color: var(--success);
}

.status-disabled {
  color: var(--text-muted);
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}
