/* =========================================
   Star Dent — основной стиль
   ========================================= */

:root {
    --primary: #0ea5a5;
    --primary-dark: #0b8585;
    --primary-light: #e0f7f7;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --text: #1f2937;
    --muted: #6b7280;
    --bg: #f5fafb;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --border: #e5e7eb;
    --danger: #ef4444;
    --success: #10b981;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(15, 42, 65, 0.06);
    --shadow-lg: 0 12px 36px rgba(15, 42, 65, 0.10);
    --transition: 180ms cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

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

h1 { font-size: 2.1rem; margin: 0 0 18px; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; margin: 28px 0 14px; letter-spacing: -0.01em; }
h3 { font-size: 1.18rem; margin: 0 0 8px; }
h4 { margin: 0 0 8px; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.link { color: var(--primary); font-weight: 500; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }

/* Skip link для доступности */
.skip-link {
    position: absolute; left: -9999px; top: 8px; background: var(--primary);
    color: #fff; padding: 8px 16px; border-radius: 8px; z-index: 1000;
}
.skip-link:focus { left: 8px; }

/* ===== HEADER ===== */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: 20px;
}
.logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.4rem; font-weight: 700; color: var(--text);
    flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo-icon {
    color: var(--accent); font-size: 1.7rem;
    display: inline-flex; width: 36px; height: 36px;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, #fff7e6, #ffe0b2);
    border-radius: 10px;
}

.main-nav { display: flex; gap: 28px; flex: 1; justify-content: center; }
.main-nav a {
    color: var(--text); font-weight: 500; padding: 8px 0;
    border-bottom: 2px solid transparent; transition: border-color var(--transition), color var(--transition);
    position: relative;
}
.main-nav a:hover { text-decoration: none; color: var(--primary); border-bottom-color: var(--primary); }
.main-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }

.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.nav-toggle {
    display: none; background: transparent; border: none; cursor: pointer;
    width: 40px; height: 40px; padding: 8px; flex-direction: column; justify-content: space-between;
}
.nav-toggle span {
    display: block; height: 3px; background: var(--text); border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* ===== MAIN ===== */
.site-main { flex: 1; padding: 32px 0 64px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-block; padding: 10px 20px;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font-size: 0.95rem; font-weight: 500; cursor: pointer;
    transition: all var(--transition); text-decoration: none; line-height: 1.2;
    text-align: center;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-link { background: transparent; color: var(--muted); border: none; }
.btn-link:hover { color: var(--primary); transform: none; box-shadow: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c62828; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }

/* ===== HERO ===== */
.hero {
    background:
        radial-gradient(circle at 90% 10%, rgba(245,158,11,0.18), transparent 45%),
        radial-gradient(circle at 10% 90%, rgba(255,255,255,0.18), transparent 50%),
        linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff; padding: 72px 40px; border-radius: 22px;
    margin-bottom: 56px; box-shadow: var(--shadow-lg);
    position: relative; overflow: hidden;
}
.hero::after {
    content: '★'; position: absolute; right: -40px; bottom: -60px;
    font-size: 280px; color: rgba(255,255,255,0.07); pointer-events: none;
    line-height: 1;
}
.hero-content { position: relative; z-index: 1; max-width: 720px; }
.hero h1 { font-size: 2.9rem; margin: 0 0 18px; line-height: 1.1; letter-spacing: -0.02em; }
.hero .lead { font-size: 1.18rem; opacity: 0.95; max-width: 640px; margin: 0 0 32px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-primary { background: #fff; color: var(--primary-dark); }
.hero .btn-primary:hover { background: #f1f5f9; }
.hero .btn-outline { color: #fff; border-color: #fff; }
.hero .btn-outline:hover { background: #fff; color: var(--primary-dark); }

.hero-meta {
    display: flex; gap: 28px; margin-top: 32px; flex-wrap: wrap;
    font-size: 0.95rem; opacity: 0.95;
}
.hero-meta span { display: flex; align-items: center; gap: 6px; }

/* ===== FEATURES ===== */
.features {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 56px;
}
.feature {
    background: var(--surface); padding: 28px 24px; border-radius: var(--radius);
    text-align: center; box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-icon {
    font-size: 2.4rem; margin-bottom: 14px;
    width: 64px; height: 64px; border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-light);
}

/* ===== SECTIONS / CARDS ===== */
.section { margin-bottom: 56px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.section-header h2 { margin: 0; }

.cards-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px;
}
.card {
    background: var(--surface); padding: 22px; border-radius: var(--radius);
    box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-footer {
    margin-top: auto; padding-top: 14px; display: flex;
    justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
}
.price { font-size: 1.25rem; font-weight: 700; color: var(--primary); }

.doctor-card { text-align: center; align-items: center; }
.doctor-avatar {
    width: 96px; height: 96px; border-radius: 50%;
    background: linear-gradient(135deg, #e0f2f1, #b2dfdb);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.8rem; margin-bottom: 10px;
    box-shadow: inset 0 -4px 8px rgba(0,0,0,0.05);
}
.specialization { color: var(--primary); font-weight: 500; margin: 0; }

/* ===== REVIEWS ===== */
.reviews-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px;
}
.review {
    background: var(--surface); padding: 22px; border-radius: var(--radius);
    box-shadow: var(--shadow); position: relative;
}
.review::before {
    content: '"'; position: absolute; top: -8px; left: 14px;
    font-size: 5rem; color: var(--primary-light); font-family: Georgia, serif;
    line-height: 1;
}
.review-text { position: relative; z-index: 1; font-style: italic; margin: 12px 0 16px; }
.review-author { display: flex; gap: 12px; align-items: center; }
.review-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), #b2dfdb);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; color: var(--primary-dark);
}
.review-stars { color: var(--accent); font-size: 0.95rem; letter-spacing: 2px; }

/* ===== FAQ ===== */
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px 20px; transition: box-shadow var(--transition);
}
.faq details[open] { box-shadow: var(--shadow-lg); }
.faq summary {
    cursor: pointer; font-weight: 600; padding: 4px 0;
    display: flex; align-items: center; gap: 10px; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
    content: '+'; color: var(--primary); font-size: 1.4rem;
    width: 22px; display: inline-flex; justify-content: center;
    transition: transform var(--transition);
}
.faq details[open] summary::before { content: '−'; }
.faq p { margin: 12px 0 4px; color: var(--muted); }

/* ===== CTA ===== */
.cta {
    background: linear-gradient(135deg, var(--surface), var(--primary-light));
    padding: 56px 32px; border-radius: var(--radius);
    text-align: center; box-shadow: var(--shadow);
    border: 1px solid var(--primary-light);
}
.cta h2 { margin-top: 0; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%; border-collapse: collapse; background: var(--surface);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-top: 16px;
}
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: var(--surface-2); font-weight: 600; font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-2); }

/* ===== BADGES ===== */
.badge {
    display: inline-block; padding: 4px 10px; border-radius: 999px;
    font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
.badge-new       { background: #dbeafe; color: #1e40af; }
.badge-confirmed { background: #d1fae5; color: #065f46; }
.badge-done      { background: #e0e7ff; color: #3730a3; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* ===== FORMS ===== */
form.card label, .booking-form label {
    display: block; margin-bottom: 14px; font-weight: 500;
}
form.card input, form.card select, form.card textarea,
.booking-form input, .booking-form select, .booking-form textarea {
    width: 100%; padding: 11px 14px; margin-top: 6px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 1rem; font-family: inherit; background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,165,0.18);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.booking-form { max-width: 760px; }

/* ===== FLASH ===== */
.flash {
    padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 16px;
    font-weight: 500; border-left: 4px solid currentColor;
    animation: slideDown .25s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.flash-success { background: #ecfdf5; color: #065f46; }
.flash-error   { background: #fef2f2; color: #991b1b; }
.flash-info    { background: #eff6ff; color: #1e40af; }

/* ===== AUTH ===== */
.auth-wrap { max-width: 440px; margin: 0 auto; }
.auth-wrap h1 { text-align: center; }

/* ===== DASHBOARD ===== */
.dashboard {
    display: grid; grid-template-columns: 240px 1fr; gap: 24px;
}
.sidebar {
    background: var(--surface); padding: 20px; border-radius: var(--radius);
    box-shadow: var(--shadow); height: fit-content; position: sticky; top: 96px;
}
.sidebar h3 { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
    padding: 10px 14px; border-radius: var(--radius-sm); color: var(--text);
    transition: background var(--transition), color var(--transition);
    display: flex; align-items: center; gap: 8px;
}
.sidebar nav a:hover { background: var(--primary-light); text-decoration: none; color: var(--primary-dark); }
.sidebar nav a.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(14,165,165,0.3); }

.content { min-width: 0; }

/* ===== STATS ===== */
.stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px; margin-bottom: 28px;
}
.stat {
    background: var(--surface); padding: 22px; border-radius: var(--radius);
    text-align: center; box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    border-top: 3px solid var(--primary);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-num {
    font-size: 1.85rem; font-weight: 700; color: var(--primary); margin-bottom: 4px;
}
.stat-label { color: var(--muted); font-size: 0.9rem; }

/* ===== BAR CHART (admin) ===== */
.chart {
    background: var(--surface); padding: 24px; border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 24px;
}
.chart h3 { margin: 0 0 16px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 20px; }
.bar {
    flex: 1; background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    border-radius: 6px 6px 0 0; position: relative; min-height: 4px;
    transition: opacity var(--transition);
}
.bar:hover { opacity: 0.85; }
.bar-value {
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    font-size: 0.75rem; font-weight: 600; color: var(--text);
}
.bar-labels { display: flex; gap: 6px; margin-top: 6px; }
.bar-labels span {
    flex: 1; text-align: center; font-size: 0.75rem; color: var(--muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ===== FILTERS / SEARCH ===== */
.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filters a {
    padding: 6px 14px; border-radius: 999px; background: var(--surface);
    color: var(--text); border: 1px solid var(--border); font-size: 0.9rem;
    transition: all var(--transition);
}
.filters a:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.filters a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filters .spacer { flex: 1; }

.search-bar { display: flex; gap: 8px; margin-bottom: 16px; max-width: 600px; flex-wrap: wrap; }
.search-bar input {
    flex: 1; min-width: 200px; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 1rem;
}

/* ===== CONTACTS ===== */
.contacts-grid {
    display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; margin-top: 24px;
}
.contact-block { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.contact-block .ico {
    width: 40px; height: 40px; border-radius: 10px; background: var(--primary-light);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem;
    flex-shrink: 0;
}
.contact-block h3 { margin: 0 0 4px; }
.contact-block p { margin: 0; }

/* ===== FOOTER ===== */
.site-footer {
    background: linear-gradient(180deg, #1f2937, #111827); color: #cbd5e1;
    padding: 48px 0 0; margin-top: auto;
}
.site-footer h4 { color: #fff; margin-bottom: 14px; font-size: 1.05rem; }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 32px; padding: 0 20px; max-width: 1200px; margin: 0 auto;
}
.footer-bottom {
    margin-top: 36px; padding: 20px 0; border-top: 1px solid #374151;
    text-align: center; font-size: 0.9rem;
}
.footer-bottom p { margin: 4px 0; }
.footer-bottom .author { color: #fff; }

/* ===== ANIMATIONS ===== */
@media (prefers-reduced-motion: no-preference) {
    .feature, .card, .review { animation: fadeUp .45s ease backwards; }
    .cards-grid > *:nth-child(1) { animation-delay: 0s; }
    .cards-grid > *:nth-child(2) { animation-delay: .05s; }
    .cards-grid > *:nth-child(3) { animation-delay: .10s; }
    .cards-grid > *:nth-child(4) { animation-delay: .15s; }
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
    .nav-toggle { display: inline-flex; order: 3; }
    .header-actions { order: 2; }
    .main-nav {
        position: fixed; top: 72px; left: 0; right: 0;
        background: var(--surface); flex-direction: column; padding: 16px 20px;
        gap: 4px; border-bottom: 1px solid var(--border);
        transform: translateY(-120%); transition: transform var(--transition);
        max-height: calc(100vh - 72px); overflow-y: auto;
        box-shadow: var(--shadow-lg);
    }
    .main-nav a { padding: 12px; border-bottom: none; border-radius: var(--radius-sm); }
    .main-nav a:hover { background: var(--surface-2); border-bottom-color: transparent; }
    .main-nav a.active { background: var(--primary-light); }
    body.nav-open .main-nav { transform: translateY(0); }

    .dashboard { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .contacts-grid { grid-template-columns: 1fr; }
    .hero { padding: 48px 28px; }
    .hero h1 { font-size: 2.1rem; }
    .hero::after { font-size: 200px; right: -30px; bottom: -50px; }
}
@media (max-width: 600px) {
    h1 { font-size: 1.6rem; }
    .header-actions .btn-link { display: none; }
    .header-actions .btn { padding: 7px 12px; font-size: 0.85rem; }
    .table { font-size: 0.88rem; }
    .table th, .table td { padding: 8px 10px; }
    .hero { padding: 36px 22px; border-radius: 16px; }
    .hero h1 { font-size: 1.8rem; }
    .hero .lead { font-size: 1rem; }
    .cta { padding: 36px 22px; }
}

/* Скрываем гамбургер при логине, если хедер слишком узкий */
@media (max-width: 380px) {
    .logo-text { display: none; }
}

/* Print */
@media print {
    .site-header, .site-footer, .nav-toggle, .header-actions, .filters, .search-bar, .btn { display: none !important; }
    .site-main { padding: 0; }
}
