/* ============================================================
   apps.css — Calculator, Terminal & App Panel Styles
   ============================================================ */

/* ────────────────────────────────────────────
   CALCULATOR APP
   ──────────────────────────────────────────── */

.calculator {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
}

/* Display */
.calculator-display {
  flex-shrink: 0;
  padding: 20px 16px 12px;
  text-align: right;
  overflow: hidden;
}

.calculator-display__expression {
  font-size: 14px;
  color: var(--text-tertiary);
  min-height: 20px;
  word-break: break-all;
  transition: color 0.25s ease;
}

.calculator-display__result {
  font-size: 40px;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.1;
  word-break: break-all;
  transition: color 0.25s ease;
}

/* Button grid */
.calculator-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  flex: 1;
}

.calculator-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 400;
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
  aspect-ratio: 1 / 1;
}

.calculator-btn:active {
  transform: scale(0.92);
}

/* Number buttons */
.calculator-btn--number {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.calculator-btn--number:hover {
  background: var(--bg-hover);
}

/* Operator buttons */
.calculator-btn--operator {
  background: var(--accent);
  color: var(--text-inverse);
  font-size: 24px;
}

.calculator-btn--operator:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Function buttons (AC, ±, %) */
.calculator-btn--function {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.calculator-btn--function:hover {
  background: var(--bg-hover);
}

/* Span 2 columns (0 button) */
.calculator-btn--wide {
  grid-column: span 2;
  aspect-ratio: auto;
}

/* ────────────────────────────────────────────
   TERMINAL APP
   ──────────────────────────────────────────── */

.terminal {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0d0d0f;
  color: #33ff33;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", "JetBrains Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.terminal-header__title {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.terminal-header__actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.terminal-header__btn {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.12s ease;
}

.terminal-header__btn:hover {
  opacity: 0.8;
}

.terminal-body {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-line {
  min-height: 1.5em;
}

.terminal-prompt {
  color: #33ff33;
}

.terminal-prompt::before {
  content: "$ ";
  color: #00cc66;
}

.terminal-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: #33ff33;
  animation: terminalBlink 1s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes terminalBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

.terminal-error {
  color: #ff3333;
}

.terminal-success {
  color: #00ff88;
}

.terminal-info {
  color: #66ccff;
}

.terminal-input {
  background: transparent;
  border: none;
  outline: none;
  color: #33ff33;
  font: inherit;
  caret-color: #33ff33;
  width: calc(100% - 1ch);
}

.terminal-input::placeholder {
  color: rgba(51, 255, 51, 0.3);
}

/* ────────────────────────────────────────────
   APP PANEL / LAUNCHPAD
   ──────────────────────────────────────────── */

.app-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 16px;
  padding: 24px;
  justify-items: center;
  align-content: start;
  overflow-y: auto;
  height: 100%;
}

.app-panel__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 80px;
  padding: 12px 4px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
  text-decoration: none;
}

.app-panel__item:hover {
  background: var(--bg-hover);
  transform: scale(1.08);
}

.app-panel__item:active {
  transform: scale(0.94);
}

.app-panel__icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.app-panel__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  pointer-events: none;
}

/* App panel search */
.app-panel__search {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 400px;
  padding: 10px 16px;
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.app-panel__search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.app-panel__search::placeholder {
  color: var(--text-tertiary);
}

/* ────────────────────────────────────────────
   COMMON SCROLLBAR STYLING (applies to all panels)
   ──────────────────────────────────────────── */

.desktop-icons::-webkit-scrollbar,
.terminal-body::-webkit-scrollbar,
.app-panel::-webkit-scrollbar,
.window-content::-webkit-scrollbar {
  width: 6px;
}

.desktop-icons::-webkit-scrollbar-track,
.terminal-body::-webkit-scrollbar-track,
.app-panel::-webkit-scrollbar-track,
.window-content::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.desktop-icons::-webkit-scrollbar-thumb,
.terminal-body::-webkit-scrollbar-thumb,
.app-panel::-webkit-scrollbar-thumb,
.window-content::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

.desktop-icons::-webkit-scrollbar-thumb:hover,
.terminal-body::-webkit-scrollbar-thumb:hover,
.app-panel::-webkit-scrollbar-thumb:hover,
.window-content::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb);
  opacity: 0.8;
}

/* Firefox scrollbar */
.desktop-icons,
.terminal-body,
.app-panel,
.window-content {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
