/* App Layout Styles (Non-Resume styling) */

:root {
  --app-bg: #0F172A; /* Dark editor bg */
  --app-surface: #1E293B;
  --app-border: #334155;
  --app-primary: #6366F1;
  --app-primary-hover: #4F46E5;
  --app-text: #F8FAFC;
  --app-text-muted: #94A3B8;
  
  --error: #EF4444;
  --success: #10B981;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--app-bg);
  color: var(--app-text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inline { display: inline-block; vertical-align: middle; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--app-text-muted); }
.mt-2 { margin-top: 0.5rem; }

/* Toolbar */
.app-toolbar {
  height: 60px;
  background-color: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  flex-shrink: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-icon {
  color: var(--app-primary);
}
.brand h1 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--app-text-muted);
}

select {
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  color: var(--app-text);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
}
select:focus { border-color: var(--app-primary); }

input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid var(--app-border); border-radius: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
}
.btn i { width: 1rem; height: 1rem; }

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

.btn-secondary { background: transparent; border: 1px solid var(--app-border); color: var(--app-text); }
.btn-secondary:hover { background: rgba(255,255,255,0.05); }

.spacer { width: 1px; height: 24px; background: var(--app-border); margin: 0 0.5rem; }

/* Workspace */
.workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* Editor Pane */
.editor-pane {
  width: 40%;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--app-border);
  background: var(--app-bg);
}

.editor-header {
  height: 40px;
  background: var(--app-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border-bottom: 1px solid var(--app-border);
}
.editor-header h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-text-muted);
  font-weight: 600;
}
.editor-status {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}
.editor-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

textarea {
  flex: 1;
  width: 100%;
  resize: none;
  background: transparent;
  border: none;
  color: #c9d1d9; /* slightly distinct from global text */
  padding: 1rem;
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  outline: none;
}
textarea::-webkit-scrollbar { width: 8px; }
textarea::-webkit-scrollbar-track { background: transparent; }
textarea::-webkit-scrollbar-thumb { background: var(--app-border); border-radius: 4px; }

/* Section Ordering UI */
.section-order-panel {
  height: 200px;
  border-top: 1px solid var(--app-border);
  background: var(--app-surface);
  padding: 1rem;
  overflow-y: auto;
}
.section-order-panel h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-text-muted);
  margin-bottom: 0.75rem;
}
.sort-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.sort-item {
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--app-text);
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.sort-item:active { cursor: grabbing; }
.sort-item.dragging { opacity: 0.5; }

/* Preview Pane */
.preview-pane {
  flex: 1;
  background: #E2E8F0; /* Light bg to contrast paper */
  overflow-y: auto;
  position: relative;
  display: flex;
  justify-content: center;
  padding: 2rem;
}
.preview-pane::-webkit-scrollbar { width: 10px; }
.preview-pane::-webkit-scrollbar-track { background: #CBD5E1; }
.preview-pane::-webkit-scrollbar-thumb { background: #94A3B8; border-radius: 5px; }

/* A4 Paper setup for standard preview */
.paper-container {
  width: 21cm; /* Standard A4 width */
  min-height: 29.7cm; /* Standard A4 height */
  background: white;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  margin: 0 auto;
  transform-origin: top center;
  position: relative;
}

/* Base Resume Page structural assumptions that themes build on */
.resume-page {
  width: 100%;
  height: 100%;
  background: white; /* Actual render background */
  color: #111;
  text-align: left;
  /* padding varies by theme */
}

/* PRINT STYLES */
@media print {
  @page {
    margin: 0;
    size: A4;
  }
  
  .non-printable { display: none !important; }
  
  body, .workspace, .preview-pane {
    height: auto;
    overflow: visible;
    background: white;
    padding: 0;
    margin: 0;
    display: block;
  }
  
  .paper-container {
    box-shadow: none;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  
  /* Ensure colors print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* Responsive constraints for the tool UI */
@media (max-width: 768px) {
  .workspace { flex-direction: column; }
  .editor-pane { width: 100%; height: 50%; border-right: none; border-bottom: 1px solid var(--app-border); }
  .preview-pane { padding: 1rem; }
  
  /* Auto-scale paper down to fit mobile */
  .paper-container {
    width: 100%; /* Fill container */
    max-width: 21cm;
    height: auto;
    min-height: 0;
  }
}
