/* Modern Medical UI Theme - Warfmadin & INR Tracking */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-dark: #1e40af;
  --accent: #06b6d4;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --bg-subtle: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.35);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 70%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  padding-bottom: 80px;
}

/* App Header */
.app-header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 20px;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}

.logo-icon svg {
  width: 26px;
  height: 26px;
  color: white;
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #60a5fa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Navigation Tabs */
.nav-bar {
  background: rgba(30, 41, 59, 0.7);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 16px;
  position: sticky;
  top: 69px;
  z-index: 90;
  backdrop-filter: blur(8px);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-container::-webkit-scrollbar { display: none; }

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.nav-btn.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.4);
}

/* Main Layout */
.main-content {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}
.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Active Urgent Alarm Banner */
.urgent-alarm-banner {
  display: none;
  background: linear-gradient(135deg, #7f1d1d, #991b1b);
  border: 2px solid #ef4444;
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
  animation: pulseAlarm 1.8s infinite;
}

.urgent-alarm-banner.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@keyframes pulseAlarm {
  0% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 35px rgba(239, 68, 68, 0.85); transform: scale(1.005); }
  100% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); }
}

.alarm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.alarm-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alarm-icon-ring {
  font-size: 2.2rem;
  animation: swing 0.8s infinite alternate ease-in-out;
}

@keyframes swing {
  0% { transform: rotate(-15deg); }
  100% { transform: rotate(15deg); }
}

.alarm-badge-count {
  background: #fef08a;
  color: #854d0e;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.alarm-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ========================================================
   FULL-SCREEN ANDROID ALARM MODAL (Alarm Saati Formatı)
   ======================================================== */
.alarm-fullscreen-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 20%, #7f1d1d 0%, #450a0a 60%, #020617 100%);
  z-index: 99999;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 36px 20px;
  text-align: center;
  color: #ffffff;
  animation: alarmModalFlash 2s infinite alternate ease-in-out;
}

.alarm-fullscreen-modal.active {
  display: flex;
}

@keyframes alarmModalFlash {
  0% { background: radial-gradient(circle at 50% 20%, #7f1d1d 0%, #450a0a 60%, #020617 100%); }
  100% { background: radial-gradient(circle at 50% 20%, #991b1b 0%, #581c87 70%, #020617 100%); }
}

.alarm-clock-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.alarm-clock-icon {
  font-size: 4.8rem;
  animation: alarmBellRing 0.5s infinite alternate ease-in-out;
  filter: drop-shadow(0 0 30px rgba(239, 68, 68, 0.9));
}

@keyframes alarmBellRing {
  0% { transform: rotate(-18deg) scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: rotate(18deg) scale(1); }
}

.alarm-time-large {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: #fef08a;
  text-shadow: 0 0 25px rgba(254, 240, 138, 0.7);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.alarm-dose-centerbox {
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #ef4444;
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.5);
  backdrop-filter: blur(12px);
}

.alarm-dose-val-large {
  font-size: 4rem;
  font-weight: 900;
  color: #60a5fa;
  line-height: 1;
  text-shadow: 0 0 30px rgba(96, 165, 250, 0.7);
  margin: 10px 0;
}

.alarm-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 440px;
  margin-bottom: 8px;
}

.btn-alarm-take {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: 800;
  padding: 20px 24px;
  border-radius: 9999px;
  border: 3px solid #6ee7b7;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: pulseTakeBtn 1.2s infinite alternate;
}

.btn-alarm-take:active {
  transform: scale(0.95);
}

@keyframes pulseTakeBtn {
  0% { transform: scale(1); box-shadow: 0 0 20px rgba(16, 185, 129, 0.5); }
  100% { transform: scale(1.05); box-shadow: 0 0 45px rgba(16, 185, 129, 1); }
}

.btn-alarm-snooze {
  background: rgba(245, 158, 11, 0.25);
  color: #fef08a;
  border: 2px solid #f59e0b;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-alarm-snooze:hover {
  background: #f59e0b;
  color: #1e293b;
}

/* Cards & Grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  border-color: #475569;
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Today Hero Card */
.today-hero {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.35) 0%, rgba(30, 41, 59, 0.9) 100%);
  border: 1px solid #3b82f6;
  position: relative;
}

.today-dose-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 16px 0;
}

.dose-number {
  font-size: 3.5rem;
  font-weight: 800;
  color: #60a5fa;
  line-height: 1;
  text-shadow: 0 0 20px rgba(96, 165, 250, 0.4);
}

.dose-unit {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pill-visual-bar {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.pill-graphic {
  display: flex;
  gap: 6px;
}

.pill-segment {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #93c5fd;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.pill-segment.half {
  background: linear-gradient(90deg, #3b82f6 50%, #475569 50%);
}

.pill-segment.quarter {
  background: linear-gradient(90deg, #3b82f6 25%, #475569 25%);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid #059669; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid #d97706; }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid #dc2626; }
.badge-info { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid #2563eb; }

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}

.btn-success {
  background: #10b981;
  color: white;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
  background: #059669;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

.btn-danger {
  background: #ef4444;
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-warning {
  background: #f59e0b;
  color: #1e293b;
}
.btn-warning:hover {
  background: #d97706;
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: #64748b;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

/* Quick Dose Selector Buttons */
.dose-chips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.chip-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.chip-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.chip-btn.active {
  background: var(--primary);
  border-color: #93c5fd;
  color: white;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
}

/* Weekly Table Styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.medical-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.medical-table th {
  background: #0f172a;
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.medical-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.medical-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
  color-scheme: dark;
}

input[type="time"].form-control {
  color: #60a5fa !important;
  font-weight: 700;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Standard Modals */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Print Specific Report Sheet Styles (Matches inr_takip_renkli.xlsx) */
.report-sheet-wrapper {
  background: #ffffff;
  color: #111827;
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  overflow-x: auto;
  margin-top: 20px;
}

.sheet-header-block {
  text-align: center;
  border-bottom: 2px solid #1e3a8a;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.sheet-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1e3a8a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sheet-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #14532d;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.sheet-table th, .sheet-table td {
  border: 1px solid #94a3b8;
  padding: 6px 8px;
  text-align: center;
}

.sheet-table th {
  background: #1e40af;
  color: #ffffff;
  font-weight: 700;
}

.sheet-table th.sub-day {
  background: #3b82f6;
  font-size: 0.8rem;
}

.sheet-table tr.color-week-1 { background: #f8fafc; }
.sheet-table tr.color-week-2 { background: #eff6ff; }
.sheet-table tr.color-week-3 { background: #f0fdf4; }
.sheet-table tr.color-week-4 { background: #fefce8; }

.sheet-table .inr-val-cell {
  font-weight: 700;
  font-size: 0.95rem;
}

/* Print Stylesheet */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
  }
  .app-header, .nav-bar, .urgent-alarm-banner, .alarm-fullscreen-modal, .btn, .no-print, .modal-backdrop {
    display: none !important;
  }
  .main-content {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .tab-pane {
    display: none !important;
  }
  #tab-reports {
    display: block !important;
  }
  .report-sheet-wrapper {
    box-shadow: none !important;
    padding: 0 !important;
    border: none !important;
  }
  @page {
    size: A4 landscape;
    margin: 10mm;
  }
}

/* Toast / Floating Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideToast 0.3s ease-out;
  min-width: 260px;
}

@keyframes slideToast {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .nav-bar {
    padding: 6px 8px;
    top: 58px;
  }
  .nav-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    overflow-x: visible;
  }
  .nav-btn {
    padding: 8px 4px;
    font-size: 0.78rem;
    font-weight: 600;
    justify-content: center;
    text-align: center;
    gap: 4px;
    white-space: normal;
    line-height: 1.2;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
  }
  .nav-btn.active {
    background: var(--primary);
    border-color: #3b82f6;
    color: #fff;
  }
  .dose-number {
    font-size: 2.8rem;
  }
  .alarm-time-large {
    font-size: 2.6rem;
  }
  .alarm-dose-val-large {
    font-size: 3.2rem;
  }
  .dose-chips-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .alarm-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .alarm-actions {
    width: 100%;
  }
  .alarm-actions .btn {
    flex: 1;
  }
  .sheet-meta-grid {
    grid-template-columns: 1fr;
  }
}
