/* =====================================================
   ExifViewer API Dashboard — Styles
   ===================================================== */

/* Custom Properties */
:root {
  --accent:         #F59E0B;
  --accent-hover:   #D97706;
  --accent-light:   #FEF3C7;
  --dark:           #18181B;
  --dark-2:         #27272A;
  --text:           #18181B;
  --text-2:         #52525B;
  --text-3:         #A1A1AA;
  --border:         #E4E4E7;
  --surface:        #FAFAFA;
  --white:          #FFFFFF;
  --success:        #10B981;
  --error:          #EF4444;
  --warning:        #F59E0B;
  --radius:         10px;
  --radius-sm:      6px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:      0 8px 30px rgba(0,0,0,0.10);
  --transition:     150ms ease;
  --sidebar-width:  260px;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--surface);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* =====================================================
   Auth Pages (index.html)
   ===================================================== */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--white) 100%);
}

.auth-container {
  width: 100%;
  max-width: 450px;
  padding: 20px;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  text-align: center;
}

.auth-logo h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 30px;
}

.auth-logo .accent {
  color: var(--accent);
}

.auth-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-2);
  margin-bottom: 30px;
}

.auth-footer {
  margin-top: 20px;
  color: var(--text-2);
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

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

.auth-link {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.auth-link a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  transition: color var(--transition);
}

.auth-link a:hover {
  color: var(--accent);
}

/* Clerk component overrides */
#clerk-signin,
#clerk-signup {
  margin-bottom: 0;
}

/* =====================================================
   Dashboard Layout
   ===================================================== */

.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.sidebar-header .accent {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all var(--transition);
  font-weight: 500;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
}

.nav-item.active {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
  border-right: 3px solid var(--accent);
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 18px;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Main Content */
.dashboard-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 30px;
  width: calc(100% - var(--sidebar-width));
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
  gap: 20px;
}

.dashboard-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-2);
  font-size: 16px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.plan-badge {
  padding: 6px 12px;
  background: var(--accent);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}

.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* =====================================================
   Cards
   ===================================================== */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.card-body {
  padding: 24px;
}

.reset-date {
  font-size: 14px;
  color: var(--text-3);
}

/* =====================================================
   API Key Display
   ===================================================== */

.api-key-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.api-key-display code {
  flex: 1;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.5px;
  overflow-x: auto;
  white-space: nowrap;
}

.help-text {
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.5;
}

/* =====================================================
   Usage Stats
   ===================================================== */

.usage-stats {
  margin-bottom: 30px;
}

.usage-number {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
}

.usage-current {
  font-size: 48px;
  font-weight: 700;
  color: var(--text);
}

.usage-separator {
  font-size: 32px;
  color: var(--text-3);
}

.usage-limit {
  font-size: 32px;
  font-weight: 500;
  color: var(--text-2);
}

.usage-label {
  font-size: 18px;
  color: var(--text-3);
  margin-left: 8px;
}

.progress-bar {
  height: 12px;
  background: var(--surface);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.3s ease;
}

.progress-fill.warning {
  background: var(--warning);
}

.progress-fill.danger {
  background: var(--error);
}

.usage-percentage {
  text-align: right;
  font-size: 14px;
  color: var(--text-3);
}

/* Plan Limits */
.plan-limits {
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}

.plan-limits h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.plan-limits ul {
  list-style: none;
  margin-bottom: 20px;
}

.plan-limits li {
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
}

.plan-limits li i {
  color: var(--success);
  font-size: 16px;
}

.plan-limits li i.fa-times {
  color: var(--text-3);
}

/* =====================================================
   Quick Links
   ===================================================== */

.quick-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition);
}

.quick-link:hover {
  background: var(--accent-light);
  transform: translateX(4px);
}

.quick-link i {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 20px;
}

.quick-link strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 2px;
}

.quick-link p {
  color: var(--text-3);
  font-size: 14px;
  margin: 0;
}

/* =====================================================
   Billing / Pricing
   ===================================================== */

.subscription-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.subscription-details p {
  margin-bottom: 8px;
  color: var(--text-2);
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.success,
.status-badge.status-success {
  background: #D1FAE5;
  color: #065F46;
}

.status-badge.error,
.status-badge.status-error {
  background: #FEE2E2;
  color: #991B1B;
}

.billing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 40px;
}

.toggle-label {
  font-weight: 600;
  color: var(--text);
}

.save-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent);
  color: var(--white);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 6px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: 0.3s;
  border-radius: 100px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--white);
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--accent);
}

input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.pricing-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  position: relative;
  transition: all var(--transition);
}

.pricing-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.pricing-card.featured {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.featured-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 16px;
  background: var(--accent);
  color: var(--white);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
}

.pricing-header h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.pricing-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
}

.pricing-price .price {
  font-size: 48px;
  font-weight: 800;
  color: var(--text);
}

.pricing-price .period {
  font-size: 18px;
  color: var(--text-3);
}

.yearly-detail {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 20px;
}

.pricing-features {
  margin: 30px 0;
}

.pricing-features ul {
  list-style: none;
}

.pricing-features li {
  padding: 10px 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-2);
}

.pricing-features li i {
  color: var(--success);
  margin-top: 4px;
  font-size: 16px;
}

.pricing-features li i.fa-times {
  color: var(--text-3);
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: background var(--transition);
}

.faq-item summary:hover {
  background: var(--accent-light);
}

.faq-item p {
  padding: 16px 20px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0;
}

/* =====================================================
   Logs Table
   ===================================================== */

.loading-state,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.loading-state i,
.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-2);
  margin-bottom: 20px;
}

.table-responsive {
  overflow-x: auto;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.logs-table thead {
  background: var(--surface);
}

.logs-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
}

.logs-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

.logs-table tr:hover {
  background: var(--surface);
}

.log-timestamp {
  font-size: 13px;
}

.log-time {
  color: var(--text-3);
}

.endpoint-code {
  padding: 4px 8px;
  background: var(--surface);
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  color: var(--text);
}

.method-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--dark);
  color: var(--white);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Monaco', monospace;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.pagination-info {
  color: var(--text-2);
  font-size: 14px;
}

/* =====================================================
   Buttons
   ===================================================== */

.btn-primary,
.btn-secondary,
.btn-outline,
.btn-ghost {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  padding: 10px 16px;
  width: 100%;
  justify-content: flex-start;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--surface);
  color: var(--text);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =====================================================
   Toast Notification
   ===================================================== */

.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 16px 24px;
  background: var(--dark);
  color: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
  max-width: 400px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--error);
}

.toast-info {
  background: var(--dark);
}

/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .dashboard-main {
    margin-left: 0;
    width: 100%;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .dashboard-main {
    padding: 20px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-header h1 {
    font-size: 24px;
  }

  .card-body {
    padding: 16px;
  }

  .usage-current {
    font-size: 36px;
  }

  .usage-limit {
    font-size: 24px;
  }

  .subscription-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .logs-table {
    font-size: 13px;
  }

  .logs-table th,
  .logs-table td {
    padding: 10px;
  }

  .toast {
    bottom: 20px;
    right: 20px;
    left: 20px;
  }
}
