/* ============================================================
   calculatorme.com — Shared Stylesheet
   Theme: Light Green + White (matching calculator.net style)
   ============================================================ */

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

:root {
  --green-dark:  #2e7d32;
  --green-main:  #43a047;
  --green-mid:   #66bb6a;
  --green-light: #c8e6c9;
  --green-pale:  #f1f8f1;
  --white:       #ffffff;
  --text-dark:   #1a1a1a;
  --text-mid:    #444;
  --text-muted:  #777;
  --border:      #c8dcc8;
  --shadow:      0 2px 10px rgba(0,0,0,0.08);
  --radius:      6px;
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: #dce8dc;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
header {
  background: var(--green-dark);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
}

.logo { font-size: 1.25rem; font-weight: 700; color: #fff; }
.logo span { color: var(--green-mid); }

/* ── Category Nav (below calculator) ── */
.cat-nav {
  background: var(--white);
  border-top: 1px solid #d0e4d0;
  padding: 2rem 1.25rem 2.5rem;
}

.cat-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text-dark);
}

.cat-item:hover { text-decoration: none; }

.cat-img-wrap {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #b2d8b2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.cat-img-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.3s;
}

.cat-item:hover .cat-img-wrap img {
  filter: grayscale(0%);
}

.cat-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--green-dark);
  text-align: center;
}

.cat-item:hover .cat-label { text-decoration: underline; }

.cat-links {
  list-style: none;
  margin-top: 0.5rem;
  width: 100%;
}

.cat-links li a {
  display: block;
  font-size: 0.82rem;
  color: var(--green-dark);
  padding: 0.2rem 0;
  text-align: center;
  text-decoration: none;
}

.cat-links li a:hover { text-decoration: underline; }

/* ── Main ── */
main {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  width: 100%;
}

/* ── Two-column page layout ── */
.page-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2.5rem;
  align-items: start;
}

/* ── LEFT: Calculator card ── */
.calc-col { min-width: 0; }

.calc-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.6rem;
}

.calc-card {
  background: var(--white);
  border: 1px solid #b8ccb8;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: inline-block;  /* shrink-wrap to content */
  min-width: 500px;
}

/* Display */
.sci-display {
  background: var(--green-dark);
  padding: 0.55rem 0.9rem;
  text-align: right;
}

.sci-expression {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  min-height: 1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sci-result {
  font-size: 1.9rem;
  font-weight: 300;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Button area ── */
.sci-calc { padding: 0.6rem; }

/* 10-column grid but col 4 of row-1 is the deg/rad cell */
.sci-buttons {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

/* Base button */
.btn {
  height: 40px;
  border: 1px solid #b0c4b0;
  border-radius: 4px;
  font-size: 0.84rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  background: #eef4ee;
  color: var(--text-dark);
  transition: background 0.1s, transform 0.07s;
  outline: none;
  user-select: none;
  padding: 0 4px;
  white-space: nowrap;
}

.btn:hover { background: var(--green-light); }
.btn:active, .btn.btn-active { transform: scale(0.93); filter: brightness(0.85); }

/* Number buttons — slightly different shade like calculator.net */
.btn-num {
  background: #d8e8d8;
  border-color: #a8c4a8;
}
.btn-num:hover { background: #c4dcc4; }

/* Operator buttons */
.btn-op {
  background: #d8e8d8;
  color: var(--text-dark);
  border-color: #a8c4a8;
  font-weight: 600;
  font-size: 1rem;
}
.btn-op:hover { background: #c4dcc4; }

/* Function buttons */
.btn-fn {
  background: #eef4ee;
  color: var(--text-dark);
  border-color: #b0c8b0;
}
.btn-fn:hover { background: var(--green-light); }

/* AC / util */
.btn-util {
  background: #d8e8d8;
  border-color: #a8c4a8;
  font-weight: 700;
}
.btn-util:hover { background: #c4dcc4; }

/* Equals */
.btn-eq {
  background: #4a7c4a;
  color: #fff;
  border-color: #3a6c3a;
  font-size: 1.1rem;
  font-weight: 700;
}
.btn-eq:hover { background: var(--green-dark); }

/* Memory */
.btn-mem {
  background: #eef4ee;
  color: var(--text-dark);
  border-color: #b0c8b0;
}
.btn-mem:hover { background: var(--green-light); }

/* Backspace */
.btn-back {
  background: #eef4ee;
  color: var(--text-dark);
  border-color: #b0c8b0;
}
.btn-back:hover { background: var(--green-light); }

/* Parenthesis */
.btn-paren {
  background: #eef4ee;
  color: var(--text-dark);
  border-color: #b0c8b0;
}
.btn-paren:hover { background: var(--green-light); }

/* ── Deg / Rad radio cell ── */
/* Sits in the grid as a single cell spanning 1 column */
.deg-rad-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  font-size: 0.82rem;
  white-space: nowrap;
  color: var(--text-dark);
  /* grid cell — same height as buttons */
  height: 40px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  font-size: 0.82rem;
}

.radio-label input[type="radio"] {
  accent-color: var(--green-dark);
  cursor: pointer;
  width: 13px;
  height: 13px;
}

/* ── RIGHT: Search panel ── */
.side-col {
  padding-top: 0.25rem;
}

.side-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

.side-search {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}

.side-search input[type="search"] {
  width: 220px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #999;
  border-right: none;
  border-radius: 3px 0 0 3px;
  font-size: 0.9rem;
  outline: none;
  background: var(--white);
  color: var(--text-dark);
}

.side-search input[type="search"]:focus {
  border-color: var(--green-dark);
}

.side-search input[type="search"]::-webkit-search-cancel-button { display: none; }

.search-btn {
  height: 34px;
  padding: 0 16px;
  border: none;
  border-radius: 0 3px 3px 0;
  background: var(--green-dark);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.search-btn:hover { background: #1b5e20; }

/* Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 320px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  list-style: none;
  z-index: 200;
  overflow: hidden;
}

.search-dropdown li a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  color: var(--text-dark);
  transition: background 0.1s;
}

.search-dropdown li a:hover { background: var(--green-pale); text-decoration: none; }

.search-dropdown li.no-results {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Footer ── */
footer {
  background: var(--green-dark);
  color: #c8e6c9;
  text-align: center;
  padding: 1rem;
  font-size: 0.84rem;
  margin-top: auto;
}

footer a { color: var(--green-mid); }
footer a:hover { color: #fff; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .page-layout { grid-template-columns: 1fr; }
  .calc-card { min-width: 0; width: 100%; display: block; }
  .side-col { margin-top: 1.5rem; }
  .cat-nav-inner { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 540px) {
  .btn { height: 36px; font-size: 0.75rem; }
  .sci-result { font-size: 1.5rem; }
  .cat-nav-inner { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .cat-img-wrap { width: 90px; height: 90px; }
  .cat-label { font-size: 0.82rem; }
}
