/* Color Palette & CSS Variables */
:root {
  --primary: #D32F2F; /* Red */
  --primary-hover: #b71c1c;
  --secondary: #FFC107; /* Yellow */
  --secondary-hover: #FFA000;
  --accent: #FFD700; /* Gold */
  
  --bg-color: #F8F9FA;
  --surface: #FFFFFF;
  --toolbar-bg: #EAECEF;
  --text-main: #212529;
  --text-muted: #6C757D;
  --border: #DEE2E6;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
  
  --radius: 8px;
  --transition: all 0.2s ease-in-out;
  --header-height: 114px;
  --toolbar-height: 56px;
  --footer-height: 48px;
}

/* Reset & Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
}

.hidden {
  display: none !important;
}

/* Application Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  /*height: var(--header-height);*/
  height: 114px;
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 100;
}

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

.brand-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.brand-model {
  height: 96px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn i {
  font-size: 1rem;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(211, 47, 47, 0.3);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--secondary);
  color: #333;
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
}

.btn-icon {
  background: transparent;
  color: var(--text-main);
  padding: 8px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(0,0,0,0.05);
  color: var(--primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Toolbar */
.toolbar {
  height: var(--toolbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 16px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--toolbar-bg);
  padding: 4px 8px;
  border-radius: 20px;
}

.page-info {
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

#page-num-input {
  width: 50px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px;
  font-family: inherit;
  font-weight: 600;
  outline: none;
}

#page-num-input:focus {
  border-color: var(--primary);
}

.zoom-info {
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 45px;
  text-align: center;
}

.divider {
  width: 1px;
  height: 20px;
  background-color: #ccc;
  margin: 0 4px;
}

/* Main Content Area */
.main-content {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  overflow: auto;
  background-color: #ECEFF1;
  /* subtle pattern */
  background-image: 
    radial-gradient(circle at 100% 150%, #ffffff 24%, #F8F9FA 25%, #F8F9FA 28%, #ffffff 29%, #ffffff 36%, #F8F9FA 36%, #F8F9FA 40%, transparent 40%, transparent),
    radial-gradient(circle at 0 150%, #ffffff 24%, #F8F9FA 25%, #F8F9FA 28%, #ffffff 29%, #ffffff 36%, #F8F9FA 36%, #F8F9FA 40%, transparent 40%, transparent);
  background-size: 50px 50px;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  animation: fadeIn 0.3s ease;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(211, 47, 47, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 12px;
}

.loading-overlay p {
  color: var(--primary);
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Error Banner */
.error-banner {
  background-color: #ffebee;
  color: var(--primary);
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 1px solid #ffcdd2;
  display: flex;
  align-items: center;
  gap: 12px;
  position: absolute;
  top: 24px;
  z-index: 20;
  box-shadow: var(--shadow-md);
  font-weight: 500;
}

/* PDF Wrapper & Canvas */
.pdf-wrapper {
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  align-items: center;
}

.pdf-page-canvas {
  background: white;
  box-shadow: var(--shadow-lg);
  display: block;
  max-width: 100%;
}

/* Footer */
.app-footer {
  height: var(--footer-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-content {
  width: 100%;
  max-width: 1200px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 16px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

/* Fullscreen handling */
:fullscreen .app-container {
  background: var(--bg-color);
}

:fullscreen .app-header,
:fullscreen .app-footer {
  display: none;
}

:fullscreen .main-content {
  padding: 16px;
}

:fullscreen .toolbar {
  border-bottom: none;
  box-shadow: var(--shadow-md);
  position: fixed;
  bottom: 24px;
  top: auto;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 30px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(5px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }
  
  .app-header {
    padding: 0 16px;
  }
  
  .toolbar {
    height: auto;
    padding: 12px 16px;
  }
  
  .toolbar-group {
    flex: 1;
    justify-content: center;
  }
  
  .main-content {
    padding: 16px 8px;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 4px;
  }
}
