/* Reusable Components: Buttons, Cards, Forms, Modals, Notifications */

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 24px; font-size: 0.95rem; font-weight: 600; border: none; border-radius: var(--radius-lg); cursor: pointer; transition: all var(--transition-normal); text-decoration: none; }
.btn.primary { background: var(--primary-gradient); color: white; box-shadow: 0 4px 14px -3px rgba(102,126,234,0.4); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px -3px rgba(102,126,234,0.5); }
.btn.secondary { background: var(--white); color: var(--dark); border: 1px solid var(--gray-light); }
.btn.secondary:hover { border-color: var(--primary-color); background: var(--primary-light); }
.btn.small { padding: 8px 16px; font-size: 0.875rem; }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn i { font-size: 1rem; }

/* Create Project Button - Primary CTA */
.create-project-btn,
.create-first-project-btn,
#wizard-create-project {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 25px -5px rgba(102, 126, 234, 0.4);
    transition: all 0.25s ease;
}

.create-project-btn:hover,
.create-first-project-btn:hover,
#wizard-create-project:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px -5px rgba(102, 126, 234, 0.5);
}

.create-project-btn i,
.create-first-project-btn i,
#wizard-create-project i {
    font-size: 1rem;
}

/* Select Project Button */
.select-project-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.select-project-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -3px rgba(102, 126, 234, 0.4);
}

/* CTA Buttons */
.cta-button { /* base styles if needed */ }
.cta-button.primary { background: var(--white); color: var(--primary-color); }
.cta-button.secondary { background: rgba(255, 255, 255, 0.2); color: var(--white); border: 2px solid rgba(255, 255, 255, 0.3); backdrop-filter: blur(10px); }
.cta-button.tertiary { background: linear-gradient(45deg, #667eea, #764ba2); color: var(--white); border: none; text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem; }
.cta-button:hover { transform: translateY(-3px); box-shadow: var(--shadow-xl); }

.cta-button.wave-planner { background: linear-gradient(135deg, #3b2e8a 0%, #764ba2 50%, #f093fb 100%); color: var(--white); }
.cta-button.wave-planner i { color: var(--white); }

.upload-btn {
    background: var(--primary-gradient);
    color: var(--white);
    border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}
.upload-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.process-btn {
    background: var(--accent-gradient);
    color: var(--white);
    border: none;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.process-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.download-btn {
    background: var(--success-color);
    color: var(--white);
    border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: 0 auto;
}
.download-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* Download Buttons */
.download-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: 2px solid var(--primary, #7c3aed);
  border-radius: 10px;
  background: transparent;
  color: var(--primary, #7c3aed);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.download-btn:hover {
  background: var(--primary, #7c3aed);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.download-btn.primary {
  background: var(--primary, #7c3aed);
  color: white;
}

.download-btn.primary:hover {
  background: #6d28d9;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.download-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== CARDS ===== */
.card {
    background: var(--background);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-xl); }
.card h3 { margin: 0 0 var(--space-xs); font-size: 1.25rem; }

/* ===== FORMS ===== */
.form-group { margin-bottom: var(--space-md); }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; color: var(--dark); }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 14px 16px; font-size: 1rem; font-family: inherit; border: 2px solid var(--gray-light); border-radius: var(--radius-lg); background: var(--white); color: var(--dark); transition: all var(--transition-fast); }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(102,126,234,0.1); }
.form-group input::placeholder { color: var(--gray); }
.form-group .input-error { color: var(--error-color); font-size: 0.85rem; margin-top: 6px; }
.form-group.invalid input { border-color: var(--error-color); }

/* ===== MODALS ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
}

.modal[style*="display: block"],
.modal[style*="display:block"] {
  display: flex !important;
}

.modal-content { background: var(--white); margin: 8vh auto; border-radius: var(--radius-2xl); width: 90%; max-width: 500px; box-shadow: var(--shadow-xl); overflow: hidden; animation: modalIn 0.3s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { padding: var(--space-lg) var(--space-xl); border-bottom: 1px solid var(--gray-light); display: flex; justify-content: space-between; align-items: center; background: var(--white); }
.modal-header h2 { margin: 0; font-size: 1.35rem; font-weight: 700; color: var(--dark); }
.modal-close { background: none; border: none; font-size: 1.75rem; color: var(--gray); cursor: pointer; padding: 0; line-height: 1; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); transition: all var(--transition-fast); }
.modal-close:hover { background: var(--gray-lighter); color: var(--dark); }
.modal-body { padding: var(--space-xl); background: var(--white); }
.modal-footer { padding: var(--space-lg) var(--space-xl); border-top: 1px solid var(--gray-light); display: flex; justify-content: flex-end; gap: var(--space-sm); background: var(--gray-lighter); }

@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}
.modal-content.shake { animation: shake 0.4s ease-in-out; }

@media (max-width: 768px) {
    .modal-content { margin: 10% auto; width: 95%; }
}

/* ===== AUTH MODAL SPECIFIC STYLES ===== */
.modal-content.auth {
    max-width: 420px;
}

.auth-modal-body {
    padding: var(--space-xl);
}

/* OAuth Buttons */
.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: var(--space-lg);
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-lg);
    background: var(--white);
    color: var(--dark);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.oauth-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.oauth-btn img,
.oauth-btn svg {
    width: 20px;
    height: 20px;
}

.oauth-btn.google {
    border-color: #e5e7eb;
}

.oauth-btn.google:hover {
    border-color: #4285f4;
    background: rgba(66, 133, 244, 0.05);
}

.oauth-btn.microsoft {
    border-color: #e5e7eb;
}

.oauth-btn.microsoft:hover {
    border-color: #00a4ef;
    background: rgba(0, 164, 239, 0.05);
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: var(--space-lg) 0;
    color: var(--gray);
    font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-light);
}

/* Auth Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.auth-form .form-group {
    margin-bottom: 0;
}

.auth-form .form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.auth-form .form-group input {
    padding: 14px 16px;
    font-size: 1rem;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.auth-form .form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    outline: none;
}

.auth-form .form-group input::placeholder {
    color: #9ca3af;
}

/* Password Field with Toggle */
.password-field {
    position: relative;
}

.password-field input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--dark);
}

/* Password Hint */
.password-hint {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 6px;
}

/* Forgot Password Link */
.forgot-password {
    font-size: 0.9rem;
    color: var(--primary-color);
    text-decoration: none;
    margin-top: 4px;
    display: inline-block;
}

.forgot-password:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

/* Auth Modal Footer */
.auth-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-xl);
    background: var(--gray-lighter);
    border-top: 1px solid var(--gray-light);
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

.auth-modal-footer .btn {
    min-width: 100px;
}

.auth-modal-footer .btn.primary {
    background: var(--primary-gradient);
    color: white;
    padding: 12px 24px;
    font-weight: 600;
}

.auth-modal-footer .btn.secondary {
    background: var(--white);
    color: var(--dark);
    border: 1px solid var(--gray-light);
    padding: 12px 24px;
}

/* Auth Error Message */
.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error-color);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
}

/* ===== NOTIFICATIONS ===== */
.notification { position: fixed; top: 100px; right: 24px; background: var(--white); border-radius: var(--radius-lg); padding: 16px 20px; box-shadow: var(--shadow-xl); z-index: 3000; transform: translateX(400px); transition: transform var(--transition-normal); max-width: 380px; border-left: 4px solid var(--primary-color); }
.notification.show { transform: translateX(0); }
.notification.success { border-left-color: var(--success-color); }
.notification.error { border-left-color: var(--error-color); }
.notification.warning { border-left-color: var(--warning-color); }
.notification-content { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.notification-content i { font-size: 1.25rem; }
.notification.success i { color: var(--success-color); }
.notification.error i { color: var(--error-color); }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--white);
}
.badge.rfactor { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.badge.complexity { background: linear-gradient(135deg, #f59e0b, #d97706); }

/* ===== SVG ICONS ===== */
.sw-icon {
    width: 1.1em;
    height: 1.1em;
    display: inline-block;
    vertical-align: -0.15em;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sw-icon.filled { fill: currentColor; stroke: none; }
.icon-badge .sw-icon { width: 1.9em; height: 1.9em; stroke-width: 2.4; stroke: #fff; }
.btn .sw-icon, .hero-cta .sw-icon { margin-right: 0.4em; }
.sw-icon .sw-blob { fill: url(#swAccent); opacity: 0.2; }

/* ===== SPINNER ===== */
.sw-spinner {
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: swSpin .8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes swSpin { to { transform: rotate(360deg); } }

/* ===== COOKIE BANNER ===== */
.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    background: #111827;
    color: #f9fafb;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    display: none;
    z-index: 4000;
}
.cookie-banner.show { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cookie-banner .text { flex: 1 1 auto; font-size: 0.95rem; }
.cookie-banner .actions { display: flex; gap: 10px; }
.cookie-banner a { color: #93c5fd; text-decoration: underline; }
.cookie-banner .btn.accept { background: var(--primary-gradient); color: #fff; border: none; padding: 10px 14px; border-radius: 10px; font-weight: 600; cursor: pointer; }

/* ===== CALLOUTS ===== */
.callout {
    position: relative;
    padding: 14px 16px 14px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--gray-light);
    box-shadow: var(--shadow-sm);
    margin: 0 0 var(--space-xl);
}
.callout::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 6px;
    border-radius: 14px 0 0 14px;
    background: linear-gradient(180deg, #8b5cf6, #10b981, #f59e0b);
}
.callout .callout-title { font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.callout .callout-link { font-weight: 600; margin-left: 8px; }
.callout.exec-summary { background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%); }

/* ===== DIAGNOSTICS ===== */
.diag-box { background: #fff; border: 1px solid var(--gray-light); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow-sm); }
.diag-box .diag-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; color: #1f2937; }
.diag-box .diag-body { font-size: 0.85rem; color: #4b5563; }

/* Project options in step 1 */
.project-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.project-option:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.project-info {
  flex: 1;
}

.project-info strong {
  display: block;
  color: #1e293b;
  margin-bottom: 4px;
}

.project-date {
  font-size: 0.8rem;
  color: #64748b;
}

.project-desc {
  font-size: 0.85rem;
  color: #64748b;
  margin: 4px 0 0;
}

.project-actions {
  display: flex;
  gap: 8px;
}

/* Wave plan list in modal */
.waveplan-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.waveplan-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.waveplan-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Modal improvements for scrolling */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}

.modal-content {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0; /* Important for flex scroll */
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

/* Account Dropdown - Fixed styling */
.account-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
  color: inherit;
  font-size: 0.9rem;
}

.account-btn:hover {
  background: rgba(255,255,255,0.1);
}

.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.account-email {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  overflow: hidden;
  z-index: 1000;
  display: none;
}

.account-dropdown[aria-hidden="false"] {
  display: block;
}

.account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  color: #1e293b;
  font-size: 0.95rem;
}

.account-item:hover {
  background: #f1f5f9;
}

.account-item i {
  width: 18px;
  color: #64748b;
}
