/*
 * Photo2Form - Common Styles
 * Shared CSS for consistent theming across all pages
 */

/* ===============================================
   ROOT VARIABLES - Edit these to change theme
   =============================================== */
:root {
  /* Colors */
  --primary-color: #1976D2;
  --primary-hover: #0d47a1;
  --primary-light: #42a5f5;
  --secondary-color: #666;
  --secondary-hover: #444;
  --success-color: #4CAF50;
  --success-hover: #2e7d32;
  --error-color: #f44336;
  --error-hover: #b71c1c;
  --warning-color: #ff9800;
  --warning-hover: #e65100;
  --info-color: #2196F3;

  /* Backgrounds */
  --bg-body: #ffffff;           /* WHITE BACKGROUND */
  --bg-page: #ffffff;           /* White for page edges */
  --bg-container: #ffffff;      /* White container background */
  --bg-section: #ffffff;        /* Section/card background */
  --bg-input: #ffffff;
  --bg-disabled: #f5f5f5;
  --bg-hover: #f9f9f9;

  /* Borders */
  --border-color: #D0D0D0;
  --border-color-light: #E0E0E0;
  --border-radius-sm: 4px;
  --border-radius: 6px;
  --border-radius-lg: 8px;
  --border-radius-xl: 12px;

  /* Text */
  --text-primary: #333;
  --text-secondary: #666;
  --text-disabled: #999;
  --text-light: #888;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-xl: 0 8px 24px rgba(0,0,0,0.15);

  /* Spacing */
  --spacing-xs: 5px;
  --spacing-sm: 10px;
  --spacing-md: 15px;
  --spacing-lg: 20px;
  --spacing-xl: 30px;
  --spacing-2xl: 40px;

  /* Typography */
  --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --font-family-mono: 'Courier New', Consolas, monospace;
  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-base: 14px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-2xl: 28px;
  --line-height-base: 1.6;
  --line-height-tight: 1.4;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Z-index layers */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ===============================================
   BASE STYLES
   =============================================== */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-base);
  margin: 0;
  padding: var(--spacing-2xl);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: var(--line-height-base);
  font-size: var(--font-size-base);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  margin-top: 0;
  line-height: var(--line-height-tight);
  font-weight: 600;
}

h1 {
  font-size: var(--font-size-2xl);
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

h2 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--spacing-md);
}

h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--spacing-sm);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

/* ===============================================
   LAYOUT
   =============================================== */
.container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-container);
  padding: 20px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color-light);
}

.section {
  margin-bottom: 25px;
  padding: var(--spacing-lg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-section);
}

.section h2,
.section h3 {
  margin-top: 0;
  color: var(--text-primary);
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 8px;
}

.section.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ===============================================
   FORMS
   =============================================== */
label {
  font-weight: bold;
  display: block;
  margin-top: 12px;
  margin-bottom: 5px;
  color: var(--text-primary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-family: var(--font-family-base);
  transition: var(--transition-base);
}

select[multiple] {
  min-height: 150px;
}

textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

input:disabled,
textarea:disabled,
select:disabled {
  background-color: var(--bg-disabled);
  cursor: not-allowed;
  color: var(--text-disabled);
}

/* ===============================================
   BUTTONS
   =============================================== */
button,
.btn {
  padding: 12px 24px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: var(--font-size-md);
  margin-right: var(--spacing-sm);
  margin-top: var(--spacing-sm);
  font-weight: 600;
  font-family: var(--font-family-base);
  transition: var(--transition-base);
  display: inline-block;
  text-align: center;
  line-height: 1;
}

button:hover:not(:disabled),
.btn:hover:not(:disabled) {
  background-color: var(--primary-hover);
  color: white;  /* Keep text white on hover (override a:hover color change) */
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active:not(:disabled),
.btn:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled,
.btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

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

button.secondary:hover:not(:disabled),
.btn.secondary:hover:not(:disabled) {
  background-color: var(--secondary-hover);
  color: white;
}

button.success,
.btn.success {
  background-color: var(--success-color);
}

button.success:hover:not(:disabled),
.btn.success:hover:not(:disabled) {
  background-color: var(--success-hover);
  color: white;
}

button.error,
button.danger,
.btn.error,
.btn.danger {
  background-color: var(--error-color);
}

button.error:hover:not(:disabled),
button.danger:hover:not(:disabled),
.btn.error:hover:not(:disabled),
.btn.danger:hover:not(:disabled) {
  background-color: var(--error-hover);
  color: white;
}

button.warning,
.btn.warning {
  background-color: var(--warning-color);
}

button.warning:hover:not(:disabled),
.btn.warning:hover:not(:disabled) {
  background-color: var(--warning-hover);
  color: white;
}

/* Button sizes */
button.btn-sm,
.btn.btn-sm {
  padding: 8px 16px;
  font-size: var(--font-size-sm);
}

button.btn-lg,
.btn.btn-lg {
  padding: 16px 32px;
  font-size: var(--font-size-lg);
}

/* ===============================================
   UTILITIES
   =============================================== */
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.back-link:hover {
  text-decoration: underline;
}

.status {
  padding: 10px 15px;
  border-radius: 4px;
  margin: 10px 0;
}

.status.success {
  background: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid var(--success-color);
}

.status.error {
  background: #ffebee;
  color: #c62828;
  border-left: 4px solid var(--error-color);
}

.status.info {
  background: #e3f2fd;
  color: #1565c0;
  border-left: 4px solid var(--primary-color);
}

.status.warning {
  background: #fff3e0;
  color: #e65100;
  border-left: 4px solid var(--warning-color);
}

.spinner {
  display: none;  /* Hidden by default, shown only during STL generation */
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
  margin-left: 8px;
}

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

/* ===============================================
   RESPONSIVE
   =============================================== */
@media (max-width: 768px) {
  body {
    padding: var(--spacing-lg);
  }

  .container {
    padding: var(--spacing-md);
  }

  .section {
    padding: var(--spacing-md);
  }

  button,
  .btn {
    width: 100%;
    margin-right: 0;
  }

  h1 {
    font-size: var(--font-size-xl);
  }

  h2 {
    font-size: var(--font-size-lg);
  }
}

/* ===============================================
   GRID LAYOUTS
   =============================================== */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.option-group {
  padding: 12px;
  background: #f9f9f9;
  border-radius: 4px;
  border: 1px solid var(--border-color-light);
}

.option-group label {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.option-group select {
  margin-bottom: 0;
}

/* ===============================================
   FLASH MESSAGES
   =============================================== */
.flash-messages {
  margin-bottom: 20px;
}

.flash {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.flash.error {
  background: #ffebee;
  color: #c62828;
}

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

.flash.warning {
  background: #fff3e0;
  color: #e65100;
}

.flash.info {
  background: #e3f2fd;
  color: #1565c0;
}
