/**
 * HiLaTeX Plugin — Default Styles v2.0
 * Provides a clean, functional editor UI out of the box.
 * Themes can override these styles for custom look & feel.
 *
 * @package HiLaTeX
 */

/* ── Layout ── */
.hilatex-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 0;
  margin: 0;
  min-height: 600px;
  height: 75vh;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

/* ── Toolbar ── */
.hilatex-actions {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
  order: -1;
}

.hilatex-actions button {
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hilatex-compile {
  background: #2196F3;
  color: #fff;
}
.hilatex-compile:hover { background: #1976D2; }
.hilatex-compile:disabled { opacity: 0.7; cursor: wait; }

.hilatex-download {
  background: #4CAF50;
  color: #fff;
}
.hilatex-download:hover { background: #388E3C; }

.hilatex-clear {
  background: transparent;
  color: #666;
  border: 1px solid #ddd;
}
.hilatex-clear:hover { background: #ffebee; color: #d32f2f; border-color: #ef9a9a; }

/* ── Editor Panel ── */
.hilatex-editor {
  height: 100%;
  min-height: 0;
  border: none;
  border-right: 1px solid #e0e0e0;
  grid-row: 2;
  grid-column: 1;
  position: relative;
  overflow: hidden;
}

/* ── Preview Panel ── */
.hilatex-preview-wrapper {
  background: #e8e8e8;
  padding: 16px;
  overflow-y: auto;
  overflow-x: auto;
  grid-row: 2;
  grid-column: 2;
  position: relative;
  min-height: 0;
  height: 100%;
}

/* ── Preview Paper ── */
#hilatex-preview {
  color: #1a1a1a;
  position: relative;
  min-height: 100px;
  transform-origin: top left;
}

#hilatex-preview .ltx-page {
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1), 0 4px 16px rgba(0,0,0,0.08);
  margin: 0 auto 20px;
}

#hilatex-preview .hilatex-rendered {
  color: #1a1a1a;
}

/* ── Spinners ── */
.hilatex-compile-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: #2196F3;
  border-radius: 50%;
  animation: hilatex-spin 0.8s linear infinite;
}

.hilatex-btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: hilatex-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes hilatex-spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ── */
@media (max-width: 980px) {
  .hilatex-container {
    grid-template-columns: 1fr;
    height: auto;
  }

  .hilatex-editor {
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
    min-height: 400px;
    height: 400px;
  }

  .hilatex-preview-wrapper {
    min-height: 500px;
    max-height: 80vh;
  }
}

/* ── Print ── */
@media print {
  .hilatex-container,
  .hilatex-editor,
  .hilatex-actions {
    display: none !important;
  }

  .hilatex-preview-wrapper {
    background: #fff;
    padding: 0;
  }

  #hilatex-preview .ltx-page {
    box-shadow: none;
    margin: 0;
    width: 100%;
  }
}
