/* СмИТ Биллинг 1.0 Documentation — Green Palette, Light/Dark Theme */

:root {
  --primary: #2e7d32;
  --primary-dark: #1b5e20;
  --primary-light: #4caf50;
  --bg-light: #e8f5e9;
  --bg-body: #fafafa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --border: #c8e6c9;
  --text: #212121;
  --text-light: #555;
  --text-white: #fff;
  --sidebar-width: 280px;
  --header-height: 56px;
  --code-bg: #263238;
  --code-color: #eeffee;
  --table-hover: #f9fdf9;
  --table-border: #eee;
  --footer-border: #eee;
  --shadow: rgba(0,0,0,.15);
  --card-shadow: rgba(46,125,50,.12);
}

[data-theme="dark"] {
  --primary: #4caf50;
  --primary-dark: #81c784;
  --primary-light: #66bb6a;
  --bg-light: #1a2e1a;
  --bg-body: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --border: #2d4a2d;
  --text: #e2e8f0;
  --text-light: #94a3b8;
  --text-white: #f1f5f9;
  --code-bg: #0d1117;
  --code-color: #a5d6a7;
  --table-hover: #1a2e1a;
  --table-border: #334155;
  --footer-border: #334155;
  --shadow: rgba(0,0,0,.4);
  --card-shadow: rgba(76,175,80,.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg-body);
  line-height: 1.6;
  transition: background-color .3s, color .3s;
}

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

/* Header */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: linear-gradient(135deg, #1b5e20, #2e7d32);
  color: var(--text-white);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 2px 4px var(--shadow);
}

[data-theme="dark"] .header {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border-bottom: 1px solid #334155;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #43a047, #26a69a);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}

.logo-text span {
  font-weight: 300;
  opacity: .85;
}

.logo-text .logo-main {
  font-weight: 700;
  opacity: 1;
}

.logo-text .logo-main::after {
  content: '| ';
  font-weight: 300;
  opacity: .85;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-white);
  font-size: 1.5rem;
  cursor: pointer;
  margin-right: 12px;
}

/* Theme toggle */
.theme-toggle {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: var(--text-white);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background .2s, transform .2s;
}

.theme-toggle:hover {
  background: rgba(255,255,255,.25);
  transform: scale(1.05);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { line-height: 1; }

[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root .theme-toggle .icon-sun { display: none; }
:root .theme-toggle .icon-moon { display: inline; }

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 90;
  transition: transform .25s ease, background-color .3s;
}

.sidebar nav ul {
  list-style: none;
}

.sidebar nav ul li a {
  display: block;
  padding: 10px 24px;
  color: var(--text);
  font-size: .9rem;
  border-left: 3px solid transparent;
  transition: all .15s;
}

.sidebar nav ul li a:hover {
  background: var(--bg-light);
  color: var(--primary);
  text-decoration: none;
  border-left-color: var(--primary-light);
}

.sidebar nav ul li a.active {
  background: var(--bg-light);
  color: var(--primary-dark);
  font-weight: 600;
  border-left-color: var(--primary);
}

/* Parent item with submenu */
.sidebar nav ul li.has-children > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.sidebar nav ul li.has-children > a .arrow {
  font-size: .6rem;
  transition: transform .2s;
  opacity: .5;
  margin-left: 6px;
  flex-shrink: 0;
}

.sidebar nav ul li.has-children.open > a .arrow {
  transform: rotate(90deg);
}

/* Submenu */
.sidebar nav ul ul.submenu {
  display: none;
  padding: 0;
}

.sidebar nav ul li.has-children.open > ul.submenu {
  display: block;
}

.sidebar nav ul ul.submenu li a {
  padding: 6px 24px 6px 40px;
  font-size: .82rem;
  color: var(--text-light);
  border-left: 3px solid transparent;
}

.sidebar nav ul ul.submenu li a:hover {
  color: var(--primary);
  background: var(--bg-light);
  border-left-color: var(--primary-light);
}

.sidebar nav ul ul.submenu li a.active {
  color: var(--primary-dark);
  font-weight: 600;
  background: var(--bg-light);
  border-left-color: var(--primary);
}

.sidebar .nav-section {
  padding: 8px 24px 4px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
  margin-top: 8px;
}

[data-theme="dark"] .sidebar .nav-section { color: #64748b; }

/* Content */
.content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 32px 40px;
  max-width: 960px;
}

.content h1 {
  font-size: 1.8rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.content h2 {
  font-size: 1.35rem;
  color: var(--primary);
  margin: 28px 0 12px;
}

.content h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin: 20px 0 8px;
}

.content p { margin: 8px 0; color: var(--text-light); }

.content ul, .content ol {
  margin: 8px 0 8px 24px;
  color: var(--text-light);
}

.content li { margin: 4px 0; }

/* Cards grid (home page) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow .2s, border-color .2s;
}

.card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 12px var(--card-shadow);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--primary);
}

.card p {
  font-size: .85rem;
  color: var(--text-light);
  margin: 0;
}

.card a {
  display: block;
  text-decoration: none;
}

.card .icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: .9rem;
}

th {
  background: var(--bg-light);
  color: var(--primary-dark);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
}

td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--table-border);
  color: var(--text-light);
}

tr:hover { background: var(--table-hover); }

/* Code blocks */
pre, code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: .85rem;
}

pre {
  background: var(--code-bg);
  color: var(--code-color);
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 12px 0;
}

code {
  background: var(--bg-light);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--primary-dark);
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Breadcrumb */
.breadcrumb {
  font-size: .8rem;
  color: #999;
  margin-bottom: 16px;
}

[data-theme="dark"] .breadcrumb { color: #64748b; }

.breadcrumb a { color: var(--primary-light); }
.breadcrumb .sep { margin: 0 6px; }

/* Child pages list */
.child-pages {
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.child-pages li {
  padding: 8px 0;
  border-bottom: 1px solid var(--table-border);
}

.child-pages li:last-child { border-bottom: none; }

.child-pages a {
  font-weight: 500;
  font-size: .95rem;
}

.child-pages .desc {
  display: block;
  font-size: .82rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* Info box */
.info-box {
  background: var(--bg-light);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  margin: 16px 0;
  font-size: .9rem;
}

/* Warning box */
.warning-box {
  background: #fff3e0;
  border-left: 4px solid #ff9800;
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  margin: 16px 0;
  font-size: .9rem;
}

[data-theme="dark"] .warning-box {
  background: #2a1f0a;
  border-left-color: #ffa726;
}

/* Footer */
.footer {
  margin-left: var(--sidebar-width);
  padding: 20px 40px;
  font-size: .75rem;
  color: #999;
  border-top: 1px solid var(--footer-border);
  margin-top: 40px;
}

[data-theme="dark"] .footer { color: #64748b; }

/* Screenshots & content images */
.screenshot, .content-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

[data-theme="dark"] .screenshot,
[data-theme="dark"] .content-image {
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  opacity: .92;
}

.screenshot { max-width: 720px; }
.content-image { max-width: 840px; }

/* Video containers */
.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin: 16px 0;
}

.video-container iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border-radius: 6px;
}

/* Scrollbar (dark theme) */
[data-theme="dark"] ::-webkit-scrollbar { width: 8px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: #1e293b; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Responsive */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 20px 16px; }
  .footer { margin-left: 0; padding: 20px 16px; }
  .cards { grid-template-columns: 1fr; }
  .logo-text { font-size: 1rem; }
  .logo-text .logo-main { display: none; }
  .logo-text span { font-weight: 600; opacity: 1; }
  .header { padding: 0 12px; }
  .header-left { gap: 8px; }
  .logo { gap: 8px; }
  .logo-icon { width: 32px; height: 32px; font-size: 1rem; }
}
