/* =====================================================================
   Raymond Rest — Светлая тема сайта (в стилистике админки)
   ===================================================================== */

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

:root {
    /* ===== ПАЛИТРА: светлая, но с тёплым оттенком ===== */
    --bg:         #f5f3ef;     /* основной фон страницы */
    --bg-side:    #ffffff;     /* сайдбар */
    --bg-card:    #ffffff;     /* карточки, контент */
    --bg-hover:   #efece6;     /* ховер */
    --border:     #e2ddd4;     /* границы */
    --border-2:   #d5cfc4;

    --text:       #2c2c2c;     /* основной текст */
    --text-dim:   #6b6b6b;     /* приглушённый */
    --text-mute:  #9a9a9a;     /* очень светлый */

    /* Акценты (те же, что в админке, но чуть ярче) */
    --accent:     #9a8d75;     /* тёплый золотой */
    --accent-2:   #b5a58a;     /* светлее */
    --accent-dk:  #7a6f5c;     /* темнее */
    --accent-bg:  rgba(154, 141, 117, 0.08);

    --wine:       #8e3d48;     /* винный (для CTA) */
    --wine-2:     #a34a56;

    --success:    #4caf50;
    --error:      #ef5350;
    --warning:    #ff9800;
    --info:       #42a5f5;

    --radius:     10px;
    --radius-sm:  6px;
    --sidebar-w:  260px;

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
    --shadow:     0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:  0 12px 32px rgba(0,0,0,0.12);
}

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { color: var(--accent-dk); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 16px;
}
h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }

p { margin-bottom: 14px; }

/* ===== APP LAYOUT ===== */
.app { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-side);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.sidebar__header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
}
.logo img { max-height: 44px; width: auto; }

.sidebar__close {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    line-height: 1;
}
.sidebar__close:hover { background: var(--bg-hover); color: var(--text); }

.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

/* Пункты меню — как .nav-item в админке */
.sidebar__nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar__nav li { margin-bottom: 2px; }

.sidebar__nav li > a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.sidebar__nav li > a:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.sidebar__nav li.active > a,
.sidebar__nav li.selected > a {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* Подменю */
.sidebar__nav ul ul {
    margin-left: 18px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
    margin-top: 4px;
    margin-bottom: 8px;
}
.sidebar__nav ul ul li > a {
    font-size: 13px;
    padding: 8px 12px;
    color: var(--text-mute);
}
.sidebar__nav ul ul li > a:hover { color: var(--text); }

.sidebar__footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-mute);
}

/* ===== CONTENT ===== */
.content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--bg-side);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    line-height: 1;
}
.hamburger:hover { background: var(--bg-hover); }

.topbar__title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}
.topbar__icon { color: var(--accent); font-size: 18px; }

.content__body {
    flex: 1;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    overflow-x: auto;
}

/* ===== OVERLAY (мобильное меню) ===== */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.25s;
}
.overlay--visible { opacity: 1; display: block; }

/* ===== BUTTONS (как в админке) ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s, transform 0.1s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.2;
}
.btn:hover { background: var(--accent-dk); color: #fff; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-dim);
}
.btn--ghost:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-2); }

.btn--wine { background: var(--wine); color: #fff; }
.btn--wine:hover { background: var(--wine-2); }

.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--xs { padding: 5px 10px; font-size: 12px; gap: 4px; }

/* ===== FORMS (как в админке, но светлые) ===== */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(154, 141, 117, 0.15);
}
input::placeholder, textarea::placeholder { color: var(--text-mute); }

select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b6b6b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea { resize: vertical; min-height: 80px; }

label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

input[type="radio"],
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    margin-right: 6px;
    vertical-align: middle;
}

/* ===== TABLES ===== */
table, .table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 14px;
    margin: 16px 0;
    box-shadow: var(--shadow-sm);
}
table th, .table th {
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
}
table td, .table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--bg-hover); }

/* ===== CARD ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid;
}
.alert--success { background: rgba(76,175,80,0.08);  border-color: var(--success); color: #2e7d32; }
.alert--error   { background: rgba(239,83,80,0.08);  border-color: var(--error);   color: #c62828; }
.alert--warning { background: rgba(255,152,0,0.08);  border-color: var(--warning); color: #e65100; }
.alert--info    { background: rgba(66,165,245,0.08); border-color: var(--info);    color: #1565c0; }

/* ===== WELCOME (главная) ===== */
.welcome {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.welcome h1 { margin-bottom: 12px; }
.welcome p { color: var(--text-dim); }

/* ===== TO-TOP ===== */
.totop {
    display: none;
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    padding: 0;
    z-index: 9999;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 50%;
    box-shadow: var(--shadow);
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}
.totop:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: translateY(-2px); }
.totop--visible { display: block; }

/* ===== UTILS ===== */
.text-center { text-align: center; }
.text-dim    { color: var(--text-dim); }
.text-mute   { color: var(--text-mute); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }
    .sidebar--open { transform: translateX(0); }
    .sidebar__close { display: block; }
    .content { margin-left: 0; }
    .hamburger { display: block; }
    .topbar { padding: 12px 16px; }
    .topbar__title { font-size: 16px; }
    .content__body { padding: 16px; }
}

@media (max-width: 600px) {
    body { font-size: 14px; }
    h1 { font-size: 22px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    table, .table { font-size: 13px; }
    table th, .table th { padding: 9px 8px; font-size: 12px; }
    table td, .table td { padding: 9px 8px; }
    .totop { right: 16px; bottom: 16px; width: 42px; height: 42px; font-size: 18px; }
}