/* ============================================================
   Herbal CMS — Admin stylesheet
   ============================================================ */

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

:root {
    --color-primary:   #2e7d52;
    --color-primary-light: #e8f5ee;
    --color-danger:    #c0392b;
    --color-warning:   #e67e22;
    --color-success:   #27ae60;
    --color-info:      #2980b9;
    --color-text:      #1a1a1a;
    --color-text-muted: #666;
    --color-border:    #ddd;
    --color-bg:        #f4f6f5;
    --color-topbar-bg: #2b5b15;
    --color-sidebar-bg: #1c2e23;
    --color-sidebar-bg: linear-gradient(90deg,rgb(28, 46, 35) 0%, rgb(27, 67, 9) 100%);
    --color-sidebar-text: #c8ddd0;
    --color-sidebar-active: #2e7d52;
    --sidebar-width:   220px;
    --topbar-height:   56px;
    --radius:          6px;
    --shadow:          0 1px 3px rgba(0,0,0,.1);
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
}

body.login {
    background: var(--color-topbar-bg);
}

/* ---- Layout ---- */
.cms-layout   { display: flex; flex-direction: column; min-height: 100vh; }

.cms-topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    background: var(--color-topbar-bg);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}
.cms-logo {
    color: #fff; text-decoration: none;
    font-size: 16px; font-weight: 600;
    letter-spacing: .3px;
}
.cms-logo span { color: var(--color-sidebar-text); font-weight: 400; font-size: 13px; margin-left: 6px; }
.cms-topbar-nav a { color: var(--color-sidebar-text); text-decoration: none; margin-left: 20px; font-size: 13px; }
.cms-topbar-nav a:hover { color: #fff; }

.cms-body {
    display: flex;
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
}

/* ---- Sidebar ---- */
.cms-sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar-bg);
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 16px 0;
}

.cms-nav-section {
    font-size: 10px; font-weight: 600; letter-spacing: 1px;
    text-transform: uppercase; color: #5a7a65;
    padding: 16px 18px 4px;
}

.cms-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 18px;
    color: var(--color-sidebar-text);
    text-decoration: none; font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}
.cms-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.cms-nav-item.active {
    background: rgba(46,125,82,.25);
    border-left-color: var(--color-primary);
    color: #fff;
}
.cms-nav-icon { font-size: 15px; width: 20px; text-align: center; }

/* ---- Main content ---- */
.cms-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 28px 32px;
}

.cms-page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.cms-page-header h1 { font-size: 20px; font-weight: 600; }

/* ---- Alerts ---- */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    margin-bottom: 20px; font-size: 13.5px;
}
.alert--success { background: #d4edda; color: #155724; border: 1px solid #b2d8bb; }
.alert--error   { background: #f8d7da; color: #721c24; border: 1px solid #f1aeb5; }
.alert--warning { background: #fff3cd; color: #856404; border: 1px solid #ffecb5; }
.alert--info    { background: #d1ecf1; color: #0c5460; border: 1px solid #b8daff; }

/* ---- Card ---- */
.card {
    background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 24px;
    margin-bottom: 24px;
}

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--color-border); }
th { font-weight: 600; font-size: 12px; text-transform: uppercase;
     letter-spacing: .5px; color: var(--color-text-muted); background: #fafafa; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafffe; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: var(--radius);
    font-size: 13.5px; font-weight: 500; cursor: pointer;
    border: 1px solid transparent; text-decoration: none;
    transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; background-color: #cb7e00; border-color: #8c5f17; color: #fff }
.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-danger   { background: var(--color-danger);  color: #fff; }
.btn-outline  { background: #fbf6e1; color: var(--color-text); border-color: var(--color-border); }
.btn-sm       { padding: 4px 10px; font-size: 12.5px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
label       { display: block; font-weight: 500; margin-bottom: 5px; font-size: 13px; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    font-size: 14px; font-family: inherit;
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}
textarea { min-height: 120px; resize: vertical; }
.form-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 4px; margin-top: 20px; }
.pagination a, .pagination span {
    padding: 5px 10px; border-radius: var(--radius);
    border: 1px solid var(--color-border); font-size: 13px; text-decoration: none;
    color: var(--color-text);
}
.pagination a:hover      { background: var(--color-primary-light); }
.pagination .current     { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ============================================================
   Bootstrap conflict overrides
   Surgical fixes only — never use all:unset as it breaks
   Summernote's Bootstrap-dependent toolbar styles
   ============================================================ */

/* Restore our body defaults that Bootstrap overrides */
body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--color-bg);
    color: #1a1a1a;
}

/* Bootstrap adds bottom margin to headings */
.cms-main h1, .cms-main h2, .cms-main h3 { margin-bottom: 0; }

/* Bootstrap resets anchor colour */
a { color: var(--color-primary); }

/* Bootstrap adds padding to body — remove it */
body { padding: 0 !important; }

/* Bootstrap makes <hr> use opacity — make ours solid */
hr { opacity: 1; border-color: var(--color-border); }

/* Summernote: ensure popover sits above everything */
.note-popover { z-index: 9999 !important; }

/* Summernote: tighten editor frame to match admin card style */
.note-editor.note-frame {
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius) !important;
    margin-bottom: 0 !important;
    padding: 0;
}
.note-editor .note-editable {
    font-family: system-ui, sans-serif !important;
    font-size: 14px !important;
    min-height: 160px;
}

/* Bootstrap container/row/col — we don't use the grid so neutralise it */
.container, .container-fluid { width: auto; padding: 0; margin: 0; }

.sticky {
    position: -webkit-sticky; /* За Safari */
    position: sticky;
    top: 65px; /* Разстояние от горния край на екрана */
    align-self: start; /* Важно: предотвратява разтягането на колоната до долу */
}