/*
 * aesthetic.css
 * A complete aesthetic and animated redesign of the Bulk Mail Sender page.
 */

/* ==================== Base Styles & Aesthetics ==================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Montserrat:wght@400;600;700&display=swap');
:root {
  /* Light Mode Variables (Blue & Gold Theme) */
  --primary-color: #2c3e50; /* Dark Blue Gray */
  --accent-color: #f39c12;  /* Vibrant Gold */
  --secondary-color: #3498db; /* Bright Blue */
  --background-start: #ecf0f1; /* Light Gray */
  --background-end: #bdc3c7;   /* Medium Gray */
  --background-color: #f9f9f9;
  --border-color: rgba(0, 0, 0, 0.1);
  --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.1);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
  --text-dark: #2c3e50;
  --text-light: #f9f9f9;
}

/* Dark Mode Variables (Deep Ocean Theme) */
body[data-theme='dark'] {
  --primary-color: #ecf0f1; /* Light Gray */
  --accent-color: #f39c12;  /* Vibrant Gold */
  --secondary-color: #3498db; /* Bright Blue */
  --background-start: #1a2a3a; /* Deep Charcoal Blue */
  --background-end: #0a162a;   /* Dark Ocean */
  --background-color: #121e2c;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-light: 0 4px 15px rgba(255, 255, 255, 0.08);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --text-dark: #ecf0f1;
  --text-light: #1f2937;
}

body {
  font-family: 'Montserrat', sans-serif;
  color: var(--text-dark);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Aligned to the top */
  position: relative;
  gap: 2rem;
  padding: 2rem 1rem;
  transition: background-color 0.5s ease;
}

.background-container {
  position: fixed; /* Use fixed for better mobile support */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--background-start), var(--background-end));
  background-size: 200% 200%;
  animation: backgroundPan 20s ease infinite;
  z-index: -2;
  transition: background 0.5s ease;
}

/* A new wrapper to manage the layout of the main content and clock */
.main-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
  max-width: 1200px;
  z-index: 1;
}

.container {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-glass);
  padding: 2.5rem;
  width: 100%;
  max-width: 60rem;
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

body[data-theme='dark'] .container {
  background: rgba(0, 0, 0, 0.15);
}

body[data-theme='dark'] .step-card,
body[data-theme='dark'] .input-field,
body[data-theme='dark'] .quill-editor,
body[data-theme='dark'] .ql-toolbar.ql-snow,
body[data-theme='dark'] .status-results-section {
  background: rgba(0, 0, 0, 0.4);
}

/* ==================== Animations ==================== */
@keyframes backgroundPan {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInFromTop {
  from { opacity: 0; transform: translateY(-50px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes textGlow {
  0%, 100% { text-shadow: 0 0 10px rgba(52, 152, 219, 0.5), 0 0 20px rgba(52, 152, 219, 0.4); }
  50% { text-shadow: 0 0 20px rgba(52, 152, 219, 0.7), 0 0 30px rgba(52, 152, 219, 0.6); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.02); opacity: 0.8; }
}

.animate-fadeIn { animation: fadeIn 1s ease-out forwards; }
.animate-slideInFromTop { animation: slideInFromTop 1s ease-out forwards; }
.animate-textGlow { animation: textGlow 3s ease-in-out infinite; }
.animate-bounceOnHover { transition: transform 0.2s ease-in-out; }
.animate-bounceOnHover:hover { transform: translateY(-3px); }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* ==================== Suspended Notice Style ==================== */
.suspended-notice {
  text-align: center;
  background: linear-gradient(45deg, #e74c3c, #c0392b);
  color: #fff;
  padding: 1rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.5);
  border: 1px solid #c0392b;
}

body[data-theme='dark'] .suspended-notice {
  background: linear-gradient(45deg, #c0392b, #e74c3c);
  color: #f9fafb;
  border: 1px solid #e74c3c;
}

/* ==================== Step-by-Step Styling ==================== */
.step-card {
  background: rgba(255, 255, 255, 0.3);
  padding: 1.5rem;
  border-radius: 15px;
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
  position: relative;
  padding-left: 5rem;
  box-shadow: var(--shadow-light);
}

/* Typo fix */
.img-logoo {
  height: 50px;
  width: 50px;
  border-radius: 30%;
}
.step-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.step-instruction {
  font-size: 0.95rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.step-card::before {
  content: '';
  position: absolute;
  left: 1.5rem;
  top: 1.5rem;
  height: 2.5rem;
  width: 2.5rem;
  background: var(--secondary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.step-card:nth-of-type(2)::before { content: '1'; }
.step-card:nth-of-type(3)::before { content: '2'; }
.step-card:nth-of-type(4)::before { content: '3'; }


/* ==================== Layout & Components ==================== */
.clock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem 3rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 20px;
  box-shadow: var(--shadow-glass);
  border: 1px solid var(--border-color);
  max-width: fit-content;
  z-index: 10;
  margin-bottom: 2rem; /* Add margin to separate from the container */
  animation: none; /* Remove clockBounce animation for a cleaner look */
}

.analog-clock .dial {
  width: 140px;
  height: 140px;
  background: rgba(255, 255, 255, 0.8);
  border: 5px solid var(--secondary-color);
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.2);
}

body[data-theme='dark'] .analog-clock .dial {
  background: rgba(0, 0, 0, 0.8);
  border-color: var(--secondary-color);
  box-shadow: inset 0 0 15px rgba(255,255,255,0.1), 0 5px 15px rgba(0,0,0,0.5);
}

.hand {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform-origin: bottom;
  background: var(--text-dark);
  border-radius: 3px;
  transform: translateX(-50%) rotate(0deg);
  transition: transform 0.5s ease;
}

.hand.hour { height: 30px; width: 5px; background: var(--primary-color); }
.hand.minute { height: 50px; width: 4px; background: var(--secondary-color); }
.hand.second { height: 60px; width: 2px; background: #e74c3c; }

body[data-theme='dark'] .hand.hour { background: var(--primary-color); }
body[data-theme='dark'] .hand.minute { background: var(--secondary-color); }

.digital-clock {
  font-family: 'Poppins', monospace;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text-dark);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
  letter-spacing: 0.1rem;
}

.header-title {
  font-family: 'Poppins', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-dark);
  margin-bottom: 2.5rem;
}

.auth-section, .mail-composer-section {
  padding-bottom: 1rem;
  margin-top: 1rem;
}

.auth-section {
  text-align: center;
}

.user-info-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

@media (min-width: 640px) {
  .user-info-row {
    flex-direction: row;
  }
}

.user-details {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.welcome-text {
  font-size: 1rem;
  color: var(--text-dark);
  margin: 0;
}

.user-name {
  font-weight: 700;
  color: var(--accent-color);
}

.google-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--text-light);
  color: var(--text-dark);
  font-weight: 600;
  padding: 0.75rem 2rem;
  border-radius: 9999px; /* Pill shape */
  box-shadow: var(--shadow-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  border: none;
}
.google-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.15);
}
.google-icon { width: 20px; height: 20px; }

/* Buttons */
.btn {
  padding: 0.75rem 2rem;
  border-radius: 9999px; /* Pill shape */
  font-weight: 600;
  color: var(--text-light);
  box-shadow: var(--shadow-light);
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn:disabled {
  background-color: #d1d5db;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-red { background-color: #e74c3c; }
.btn-red:hover { background-color: #c0392b; transform: translateY(-2px); box-shadow: 0 8px 15px -5px rgba(231, 76, 60, 0.5); }
.btn-red:active { transform: translateY(0); }

.btn-green { background-color: #2ecc71; }
.btn-green:hover { background-color: #27ae60; transform: translateY(-2px); box-shadow: 0 8px 15px -5px rgba(46, 204, 113, 0.5); }
.btn-green:active { transform: translateY(0); }

/* Glow effect for main button */
.glow-on-hover {
  position: relative;
  overflow: hidden;
  z-index: 1;
}
.glow-on-hover::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(45deg, #f39c12, #3498db, #2ecc71);
  background-size: 400%;
  border-radius: 9999px;
  z-index: -1;
  filter: blur(8px);
  animation: glow 10s linear infinite;
  opacity: 0.7;
}

@keyframes glow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Form Elements */
.form-group { margin-bottom: 1.5rem; }
.label {
  display: block;
  color: var(--text-dark);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.input-field {
  box-shadow: var(--shadow-light);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  width: 100%;
  padding: 0.75rem 1rem;
  color: var(--text-dark);
  line-height: 1.25;
  outline: none;
  background-color: rgba(255, 255, 255, 0.6);
  transition: all 0.2s ease;
}
.input-field:focus {
  box-shadow: 0 0 0 3px var(--secondary-color), var(--shadow-light);
  border-color: transparent;
}

.quill-editor {
  background-color: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  box-shadow: var(--shadow-light);
  min-height: 200px;
}
.ql-toolbar.ql-snow {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  border-color: rgba(0,0,0,0.1);
  background: rgba(255, 255, 255, 0.8);
}
.ql-container.ql-snow {
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  border-color: rgba(0,0,0,0.1);
  min-height: 150px;
}
body[data-theme='dark'] .quill-editor {
    background-color: rgba(0, 0, 0, 0.3);
}
body[data-theme='dark'] .ql-container.ql-snow {
    background-color: rgba(0, 0, 0, 0.3);
}

/* File Input */
.file-upload-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .file-upload-section {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.file-input {
  display: block;
  width: 100%;
  max-width: fit-content;
  font-size: 0.875rem;
  color: #4b5563;
}
.file-input::file-selector-button {
  margin-right: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 0;
  font-size: 0.875rem;
  font-weight: 600;
  background-color: var(--accent-color);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}
.file-input::file-selector-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px -3px var(--accent-color);
}
.recipient-count {
  color: var(--primary-color);
  font-size: 0.875rem;
}

/* Status Messages */
.status-results-section {
  padding: 1.5rem;
  background-color: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  border-radius: 15px;
  text-align: center;
  box-shadow: var(--shadow-light);
}

.current-status-message {
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0;
  color: var(--secondary-color);
}

.progress-details {
  margin-top: 1rem;
  font-size: 0.9rem;
}
.sent-count { font-weight: 700; color: #2ecc71; }
.failed-count { font-weight: 700; color: #e74c3c; }
.final-message {
  font-weight: 600;
  color: var(--primary-color);
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

/* Loader and Success Animation Styles */
#loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

#loader-spinner {
  border: 4px solid rgba(255, 255, 255, 0.5);
  border-top: 4px solid var(--accent-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s cubic-bezier(0.5, 0.2, 0.5, 0.8) infinite;
}
body[data-theme='dark'] #loader-spinner {
  border: 4px solid rgba(0, 0, 0, 0.5);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#loader-percentage {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 0.5rem;
}

#success-animation {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.checkmark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: block;
  stroke-width: 2;
  stroke: #2ecc71;
  stroke-miterlimit: 10;
  margin: 0 auto;
  box-shadow: inset 0px 0px 0px 30px #2ecc71;
  animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
}

.checkmark__circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 2;
  stroke-miterlimit: 10;
  stroke: #2ecc71;
  fill: none;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark__check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) .8s forwards;
}

@keyframes stroke {
  100% { stroke-dashoffset: 0; }
}

@keyframes fill {
  100% { box-shadow: inset 0px 0px 0px 30px #2ecc71; }
}

@keyframes scale {
  0%, 100% { transform: none; }
  50% { transform: scale3d(1.1, 1.1, 1); }
}

/* Theme Toggle Button and its container */
.theme-toggle-container {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}
.theme-toggle-btn {
  background-color: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(5px);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-light);
}
.theme-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.6);
}
body[data-theme='dark'] .theme-toggle-btn {
  background-color: rgba(0, 0, 0, 0.4);
  color: white;
}
body[data-theme='dark'] .theme-toggle-btn:hover {
  background-color: rgba(0, 0, 0, 0.6);
}


/* Utility classes to manage visibility */
.hidden { display: none !important; }

/* ==================== Custom Header & Footer Styles ==================== */
.main-header {
  background-color: var(--background-color);
  padding: 1.5rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: 'Poppins', sans-serif;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.5s ease;
}

body[data-theme='dark'] .main-header {
  background-color: var(--background-start);
  color: var(--text-dark);
}

.header-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .header-container {
    flex-direction: row;
    justify-content: space-between;
  }
}

.logo-and-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  width: 30px;
  height: 30px;
  color: var(--accent-color);
  stroke-width: 2.5;
}

.site-name {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

body[data-theme='dark'] .site-name {
  color: var(--text-dark);
}

/* New Navigation Styles */
.main-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-link {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
  position: relative;
  transition: all 0.3s ease;
}

body[data-theme='dark'] .nav-link {
  color: #a0aec0;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 0;
  height: 2px;
  background-color: var(--accent-color);
  transition: width 0.3s ease-in-out;
}

.nav-link:hover::after, .nav-link.active::after {
  width: 100%;
}

.nav-link:hover {
  color: var(--accent-color);
}

/* Custom Footer Styling */
.main-footer {
  background-color: var(--primary-color);
  color: #e2e8f0;
  padding: 1.5rem 2rem;
  margin-top: 3rem;
  font-family: 'Poppins', sans-serif;
  text-align: center;
  z-index: 1;
  transition: background-color 0.5s ease;
}
.main-footer p, .main-footer a {
  color: #ecf0f1;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-links {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-link {
  color: #a0aec0;
  text-decoration: none;
  transition: color 0.3s ease-in-out;
}

.footer-link:hover {
  color: var(--secondary-color);
}
