/* RecipeCost — общие переменные */
:root {
  --rc-cream: #FFF5E1;
  --rc-chocolate: #4E342E;
  --rc-pink: #F4C2C2;
  --rc-blue: #A2D2FF;
  --rc-white: #ffffff;
  --rc-muted: #8d6e63;
  --rc-shadow: 0 4px 24px rgba(78, 52, 46, 0.1);
  --sidebar-width: 260px;
}

/* ==== Базовое приложение ==== */
body.app-body {
  background-color: var(--rc-cream);
  color: var(--rc-chocolate);
  margin: 0;
  padding: 0;
}

.app-shell {
  min-height: 100vh;
}

.app-main {
  width: 100%;
}

.main {
  margin-bottom: 150px;
}

.page-container {
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}

h2 {
  font-weight: bold;
}

.brand-link {
  color: var(--rc-chocolate) !important;
}

/* Карточки */
.card {
  border: none;
  border-radius: 20px;
}

.card-header {
  background-color: var(--rc-pink);
  border: none;
}

.card-body {
  color: var(--rc-chocolate);
}

.card-app {
  border-radius: 20px;
  box-shadow: var(--rc-shadow);
}

/* Кнопки */
.btn-main,
.btn-primary {
  background-color: var(--rc-blue);
  color: var(--rc-chocolate);
  border: none;
  font-weight: 600;
  border-radius: 12px;
  padding: 0.55rem 1.25rem;
}

.btn-primary:hover,
.btn-main:hover {
  background-color: #91c4f7;
  color: var(--rc-chocolate);
}

.btn-auth {
  background-color: var(--rc-chocolate);
  border-color: var(--rc-chocolate);
  color: var(--rc-cream);
  font-weight: 600;
  border-radius: 12px;
  padding: 0.6rem 1.25rem;
}

.btn-auth:hover {
  background-color: #3e2a24;
  border-color: #3e2a24;
  color: var(--rc-cream);
}

.btn-outline-auth {
  border: 2px solid var(--rc-chocolate);
  color: var(--rc-chocolate);
  border-radius: 12px;
  font-weight: 600;
  background: transparent;
}

.btn-outline-auth:hover {
  background: var(--rc-chocolate);
  color: var(--rc-cream);
}

.btn-secondary {
  background-color: #c4b8b0;
  color: var(--rc-chocolate);
  border: none;
  font-weight: 500;
  border-radius: 12px;
}

.btn-danger {
  color: var(--rc-chocolate);
  border: 0;
}

/* Формы */
.form-control,
.form-select {
  color: var(--rc-chocolate);
  background-color: var(--rc-white);
  caret-color: var(--rc-chocolate);
  border-radius: 12px;
  border: 1px solid rgba(78, 52, 46, 0.15);
  padding: 0.65rem 0.85rem;
}

.form-control:focus {
  border-color: var(--rc-blue);
  box-shadow: 0 0 0 0.2rem rgba(162, 210, 255, 0.45);
}

/* Списки */
.list-group-item {
  font-size: 1.05rem;
  color: var(--rc-chocolate);
  background-color: transparent;
  padding: 1rem;
  min-height: 50px;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  border: none;
}

/* Nav pills (вкладки рецептов) */
.nav-pills {
  background-color: var(--rc-chocolate);
  border: none;
  border-radius: 30px;
}

.nav-pills .nav-link {
  background-color: transparent;
  color: var(--rc-pink);
  border: none;
  border-radius: 25px;
  font-weight: bold;
  flex-grow: 1;
  text-align: center;
  padding: 15px;
}

.nav-pills .nav-link.active {
  background-color: var(--rc-pink);
  color: var(--rc-chocolate) !important;
}

/* ==== Боковое меню (десктоп) ==== */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--rc-chocolate);
  padding: 1.5rem 1rem;
  z-index: 1040;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--rc-cream);
  font-weight: 800;
  font-size: 1.35rem;
  padding: 0.5rem 0.75rem 1.5rem;
  text-decoration: none;
}

.sidebar-brand:hover {
  color: var(--rc-pink);
}

.sidebar-brand i {
  font-size: 1.5rem;
  color: var(--rc-pink);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 245, 225, 0.15);
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  color: rgba(255, 245, 225, 0.75);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}

.app-nav-link i {
  font-size: 1.25rem;
  width: 1.5rem;
  text-align: center;
}

.app-nav-link:hover {
  color: var(--rc-cream);
  background: rgba(255, 245, 225, 0.08);
}

.app-nav-link.active {
  background: var(--rc-pink);
  color: var(--rc-chocolate);
}

.sidebar-nav-group {
  display: flex;
  flex-direction: column;
}

.sidebar-subnav {
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0.2rem 0 0.5rem 2.35rem;
  padding-left: 0.65rem;
  border-left: 2px solid rgba(244, 194, 194, 0.35);
}

.sidebar-subnav-link {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: rgba(255, 245, 225, 0.7);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.sidebar-subnav-link:hover {
  color: var(--rc-cream);
  background: rgba(255, 245, 225, 0.08);
}

.sidebar-subnav-link.active {
  color: var(--rc-pink);
  background: rgba(244, 194, 194, 0.12);
}

/* Карточки групп рецептов */
.recipe-groups-grid {
  margin-top: 0.25rem;
}

.recipe-group-card {
  background: var(--rc-white);
  border: none;
  border-radius: 20px;
  aspect-ratio: 4 / 5;
}

.recipe-group-card .card-body {
  padding: 0.5rem !important;
  height: 100%;
}

.recipe-group-card__title {
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--rc-chocolate);
}

.recipe-group-card__footer {
  margin-top: auto;
}

@media (min-width: 992px) {
  .recipe-group-card {
    border-radius: 16px;
    aspect-ratio: 5 / 6;
  }

  .recipe-group-card .card-body {
    padding: 0.45rem 0.55rem !important;
  }

  .recipe-group-card__title {
    font-size: 0.95rem;
    line-height: 1.25;
  }

  .recipe-group-card__footer .small {
    font-size: 0.75rem;
  }

  .recipe-group-card__footer .mb-2 {
    margin-bottom: 0.35rem !important;
  }
}

/* ==== Нижняя панель (мобильные) ==== */
.bottom-nav {
  background-color: var(--rc-chocolate);
  border: 0;
  border-top-right-radius: 30px;
  border-top-left-radius: 30px;
  align-items: center;
  padding: 0.35rem 0 0.5rem;
}

.bottom-nav .app-nav-link {
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.5rem 0.25rem;
  border-radius: 12px;
  font-size: 0.72rem;
  text-align: center;
  color: #aaaaaa;
}

.bottom-nav .app-nav-link i {
  font-size: 1.25rem;
  width: auto;
}

.bottom-nav .app-nav-link.active {
  color: var(--rc-pink);
  background: transparent;
}

.bottom-nav .app-nav-link:hover {
  color: #cccccc;
  background: transparent;
}

.square-btn {
  aspect-ratio: 1 / 1;
  width: 75px;
}

/* ==== Страницы авторизации ==== */
body.auth-page {
  background: linear-gradient(135deg, var(--rc-cream) 0%, #f5e8d0 50%, var(--rc-pink) 100%);
  color: var(--rc-chocolate);
  min-height: 100vh;
  margin: 0;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.auth-layout {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: var(--rc-white);
  border-radius: 24px;
  box-shadow: var(--rc-shadow);
  padding: 2rem 1.75rem;
}

.auth-brand-panel {
  display: none;
}

.auth-logo {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--rc-chocolate);
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  color: var(--rc-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.auth-tabs {
  border-bottom: 2px solid rgba(78, 52, 46, 0.1);
  margin-bottom: 1.25rem;
}

.auth-tabs .nav-link {
  color: var(--rc-muted);
  border: none;
  border-radius: 0;
  font-weight: 600;
  padding: 0.5rem 1rem;
}

.auth-tabs .nav-link.active {
  color: var(--rc-chocolate);
  background: transparent;
  border-bottom: 2px solid var(--rc-chocolate);
  margin-bottom: -2px;
}

.auth-link {
  color: var(--rc-chocolate);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link:hover {
  color: #3e2a24;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--rc-muted);
  font-size: 0.9rem;
  margin-top: 1.25rem;
}

.auth-back:hover {
  color: var(--rc-chocolate);
}

.profile-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.subscription-price-box {
  background: var(--rc-cream);
  border-radius: 14px;
  padding: 1rem;
}

/* ==== Десктоп ==== */
@media (min-width: 992px) {
  .app-sidebar {
    display: flex !important;
    flex-direction: column;
  }

  .sidebar-subnav {
    display: flex;
  }

  .recipes-tabs-mobile {
    display: none !important;
  }

  .app-main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
  }

  .app-main,
  .main {
    margin-bottom: 0 !important;
    padding-bottom: 2rem;
  }

  .bottom-nav {
    display: none !important;
  }

  .page-container {
    max-width: 1100px;
    margin: 0 auto;
    padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
    padding-right: max(1.5rem, env(safe-area-inset-right, 0px));
  }

  .profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
  }

  .profile-grid .profile-span-2 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 991.98px) {
  .app-sidebar {
    display: none !important;
  }

  .bottom-nav {
    padding-left: max(0.5rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.5rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 768px) {
  .auth-shell {
    padding: 2rem;
  }

  .auth-layout {
    max-width: 920px;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2.5rem;
    align-items: center;
  }

  .auth-brand-panel {
    display: block;
    padding: 1rem;
  }

  .auth-brand-panel h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--rc-chocolate);
    line-height: 1.2;
  }

  .auth-brand-panel p {
    color: var(--rc-muted);
    font-size: 1.05rem;
    line-height: 1.6;
  }

  .auth-brand-features {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
  }

  .auth-brand-features li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.65rem;
    color: var(--rc-chocolate);
    font-weight: 500;
  }

  .auth-brand-features i {
    color: var(--rc-blue);
    font-size: 1.1rem;
  }
}
