/* File: /home/claude/cloudflare-webapp/src/css/style.css */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

/* ========================================
   ACCESSIBILITY - Skip Link (IS 5568 / WCAG 2.4.1)
   ======================================== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  font-weight: 600;
  z-index: 10000;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

/* RTL adjustment for skip link */
[dir="rtl"] .skip-link {
  left: auto;
  right: 50%;
  transform: translateX(50%);
}

/* ========================================
   ACCESSIBILITY - Screen Reader Only
   ======================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
   ACCESSIBILITY - Focus Visible (Global)
   ======================================== */
:focus-visible {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

/* Remove focus ring for mouse users, keep for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

/* Ensure buttons and links have visible focus */
a:focus-visible,
button:focus-visible {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navbar styles removed - using nav.css instead */

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 0;
  background-color: #fff;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 3rem;
  color: #333;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.25rem;
  color: #666;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.feature {
  background-color: #fff;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
}

.feature h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #333;
}

/* Buttons - Base styles only (finance pages use finance-common.css) */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background-color: #f38020;
  color: #fff;
}

.btn-primary:hover {
  background-color: #d97019;
}

.btn-secondary {
  background-color: #fff;
  color: #f38020;
  border: 2px solid #f38020;
}

.btn-secondary:hover {
  background-color: #f38020;
  color: #fff;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #a0aec0;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-close:hover {
  background: #f7fafc;
  color: #4a5568;
}

.btn-retry {
  padding: 0.75rem 1.5rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-retry:hover {
  background: #5568d3;
}

/* Auth Pages */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.auth-box {
  background-color: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

.auth-box h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #333;
}

.auth-form {
  display: flex;
  flex-direction: column;
}

/* Form Groups - Base styles (finance pages use finance-common.css) */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #333;
  font-weight: 500;
}

.form-group label .required {
  color: #dc2626;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
  border-color: #f38020;
}

/* Focus visible for keyboard users - enhanced accessibility */
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

.form-group small {
  display: block;
  margin-top: 0.25rem;
  color: #666;
  font-size: 0.875rem;
}

/* Messages - Consolidated */
.error-message {
  background: #fed7d7;
  border: 1px solid #fc8181;
  color: #742a2a;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: none;
}

.error-message.show,
.error-message.active {
  display: block;
}

.success-message {
  background: #c6f6d5;
  border: 1px solid #9ae6b4;
  color: #22543d;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: none;
}

.success-message.show,
.success-message.active {
  display: block;
}

.info-box {
  background: linear-gradient(135deg, #bee3f8 0%, #90cdf4 100%);
  border: none;
  color: #2c5282;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(144, 205, 244, 0.3);
}

.warning-box {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  color: #856404;
}

/* Loading States */
.loading-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 20px;
  text-align: center;
}

.loading-spinner,
.spinner {
  border: 4px solid #f3f4f6;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #666;
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  color: #333;
}

.empty-state p {
  margin-bottom: 1.5rem;
  color: #666;
}

/* Error Container */
.error-container {
  text-align: center;
  padding: 3rem;
}

.error-container .error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.error-container h3 {
  margin-bottom: 0.5rem;
  color: #dc2626;
}

.error-container p {
  margin-bottom: 1.5rem;
  color: #666;
}

.auth-link {
  text-align: center;
  margin-top: 1rem;
  color: #666;
}

.auth-link a {
  color: #f38020;
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
}

/* Dashboard */
.dashboard {
  background-color: #fff;
  padding: 2rem;
  border-radius: 8px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f5f5f5;
}

.dashboard-content {
  display: grid;
  gap: 1.5rem;
}

.dashboard-card {
  background-color: #f9f9f9;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.dashboard-card h3 {
  margin-bottom: 1rem;
  color: #333;
}

#filesList {
  margin-top: 1rem;
}

.file-item {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background-color: #fff;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-item a {
  color: #f38020;
  text-decoration: none;
}

.file-item a:hover {
  text-decoration: underline;
}

#uploadStatus {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
}

#uploadStatus.success {
  background-color: #e8f5e9;
  color: #2e7d32;
}

#uploadStatus.error {
  background-color: #ffebee;
  color: #d32f2f;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer p {
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .dashboard-header {
    flex-direction: column;
    gap: 1rem;
  }
}

/* =========================================================
   Sub-D1 Task 13 — Notification bell + Inbox page
   ========================================================= */

/* Bell widget */
.notification-bell { position: relative; display: inline-block; }
.notification-bell button {
  background: none; border: 0; cursor: pointer; font-size: 1.2rem;
  position: relative; padding: 6px 10px;
}
.notification-bell-badge {
  position: absolute; top: 0; right: 0;
  background: #dc2626; color: #fff;
  font-size: 10px; line-height: 14px;
  border-radius: 999px;
  min-width: 16px; padding: 0 4px;
  text-align: center;
}
.notification-bell-dropdown {
  position: absolute; top: 100%; right: 0;
  background: #fff; color: #111;
  border: 1px solid #e5e7eb; border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  width: 320px; padding: 8px 0;
  z-index: 100;
}
.notification-bell-list { list-style: none; margin: 0; padding: 0; }
.notification-bell-list li {
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
}
.notification-bell-list li:last-child { border-bottom: 0; }
.notification-bell-list strong { display: block; font-size: 14px; }
.notification-bell-list small { color: #6b7280; font-size: 11px; }
.bell-empty { color: #6b7280; font-style: italic; }
.notification-bell-link {
  display: block; text-align: center; padding: 8px;
  color: #2563eb; text-decoration: none;
  border-top: 1px solid #e5e7eb;
}

/* Inbox page */
.page-inbox { max-width: 720px; margin: 24px auto; padding: 0 16px; }
.inbox-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.inbox-tabs .tab {
  background: none; border: 1px solid #e5e7eb;
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
}
.inbox-tabs .tab.is-active { background: #2563eb; color: #fff; border-color: #2563eb; }
.inbox-list { list-style: none; margin: 0; padding: 0; }
.inbox-item {
  display: grid; grid-template-columns: 28px 1fr 28px;
  gap: 8px; align-items: start;
  padding: 12px; border-bottom: 1px solid #f3f4f6;
}
.inbox-item.is-unread { background: #eff6ff; }
.inbox-item .inbox-cat { font-size: 18px; }
.inbox-item h3 { margin: 0 0 4px; font-size: 15px; }
.inbox-item p { margin: 0 0 6px; }
.inbox-item small { color: #6b7280; font-size: 11px; }
.inbox-dismiss {
  background: none; border: 0; cursor: pointer;
  font-size: 18px; color: #6b7280;
}
.inbox-empty { color: #6b7280; text-align: center; padding: 24px; list-style: none; }
.inbox-pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 16px; }
.inbox-cta {
  display: inline-block; padding: 6px 12px; margin: 4px 0;
  background: #2563eb; color: #fff; border-radius: 4px;
  text-decoration: none; font-size: 13px;
}

/* Sub-D1 — profile prefs matrix */
.prefs-matrix { width: 100%; border-collapse: collapse; }
.prefs-matrix th, .prefs-matrix td { padding: 8px; text-align: left; border-bottom: 1px solid #f3f4f6; }
.prefs-matrix th:nth-child(2), .prefs-matrix th:nth-child(3),
.prefs-matrix td:nth-child(2), .prefs-matrix td:nth-child(3) { width: 80px; text-align: center; }
.prefs-matrix small { color: #6b7280; }
