/* =============================================================================
   RutaTurismo360 - App Layout Styles
   =============================================================================
   Estilos globales del layout principal: sidebar, header, footer, main.
   Migrado desde MainLayout.razor.css (CSS scoped) a CSS global.
   Los selectores ::deep se convierten a descendientes regulares.
   ============================================================================= */

/* ==================== VARIABLES DE LAYOUT ==================== */

:root {
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 80px;
  --header-height: 70px;
}

/* ==================== CONTAINER PRINCIPAL ==================== */

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==================== SIDEBAR ==================== */

.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  overflow-y: auto;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
  position: relative;
  z-index: 1000;
}

.app-sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

/* Ocultar elementos cuando el sidebar está colapsado */
.app-sidebar.collapsed .logo-name,
.app-sidebar.collapsed .nav-text {
  display: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: var(--header-height);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  flex: 1;
}

.logo-container:hover {
  transform: scale(1.02);
}

.sidebar-logo-image {
  height: 50px;
  width: auto;
  max-width: 100%;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.logo-name {
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
  color: white;
}

/* ==================== SIDEBAR TOGGLE (RadzenButton) ==================== */

.sidebar-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle .rz-button {
  background: transparent !important;
  border: none !important;
  color: white !important;
  padding: 8px !important;
  min-width: auto !important;
  height: auto !important;
}

.sidebar-toggle:hover,
.sidebar-toggle .rz-button:hover {
  transform: scale(1.1);
}

.sidebar-toggle .rz-icon {
  color: white !important;
  font-size: 24px !important;
}

/* ==================== CONTENT AREA ==================== */

.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Overlay para cerrar sidebar en mobile */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  animation: layoutFadeIn 0.3s ease-out;
  cursor: pointer;
}

@keyframes layoutFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ==================== HEADER ==================== */

.app-header {
  height: var(--header-height);
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.3s ease;
}

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

/* ==================== MOBILE MENU (RadzenButton) ==================== */

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: white;
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition);
}

.mobile-menu-btn .rz-button {
  background: transparent !important;
  border: none !important;
  color: white !important;
  padding: 8px !important;
  min-width: auto !important;
  height: auto !important;
}

.mobile-menu-btn:hover,
.mobile-menu-btn .rz-button:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.mobile-menu-btn .rz-icon {
  color: white !important;
  font-size: 28px !important;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: white;
  margin: 0;
}

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

.header-actions {
  display: flex;
  gap: 5px;
}

/* ==================== BTN-ICON (RadzenButton) ==================== */

.btn-icon {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.btn-icon .rz-button {
  background: transparent !important;
  border: none !important;
  color: white !important;
  padding: 8px !important;
  min-width: auto !important;
  height: auto !important;
}

.btn-icon:hover,
.btn-icon .rz-button:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.btn-icon .rz-icon {
  color: white !important;
  font-size: 24px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

/* Efecto de rotación para el botón de tema */
.btn-icon:active .rz-icon {
  transform: rotate(180deg);
}

/* ==================== BADGE ==================== */

.badge {
  position: absolute;
  top: 0;
  right: 0;
  background-color: var(--danger-color);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.badge .rz-badge {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 10px !important;
  min-width: 18px !important;
  padding: 2px 6px !important;
}

/* ==================== USER MENU ==================== */

.user-menu {
  position: relative;
}

/* BTN-USER (RadzenButton) */
.btn-user {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  color: white;
}

.btn-user .rz-button {
  background: transparent !important;
  border: none !important;
  color: white !important;
  padding: 8px 16px !important;
  min-width: auto !important;
  height: auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.btn-user:hover,
.btn-user .rz-button:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.user-info strong {
  font-size: 14px;
  color: white;
}

.user-info small {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.dropdown-arrow {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  transition: var(--transition);
}

.btn-user:hover .dropdown-arrow {
  transform: translateY(2px);
}

/* ==================== USER DROPDOWN ==================== */

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  margin-top: 8px;
  z-index: 100;
  animation: layoutSlideDown 0.3s ease-out;
}

@keyframes layoutSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* DROPDOWN-ITEM (RadzenButton con ChildContent) */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
}

.dropdown-item:hover {
  background-color: var(--background-light);
  color: var(--primary-color);
}

.dropdown-item.logout:hover {
  color: var(--danger-color);
}

.dropdown-item .rz-icon {
  font-size: 20px !important;
  flex-shrink: 0;
}

.dropdown-item.logout .rz-button {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  width: 100% !important;
  justify-content: flex-start !important;
  font-family: inherit !important;
  font-size: 14px !important;
  color: var(--text-dark) !important;
  min-width: auto !important;
  height: auto !important;
}

.dropdown-item.logout:hover .rz-button {
  color: var(--danger-color) !important;
  background: transparent !important;
}

.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 8px 0;
}

/* ==================== MAIN CONTENT ==================== */

.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
  isolation: isolate;
}

.content-wrapper {
  width: 100%;
}

/* ==================== FOOTER ==================== */

.app-footer {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 15px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  transition: background 0.3s ease;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-left,
.footer-right {
  display: flex;
  align-items: center;
}

.footer-left p,
.footer-right p {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
}

.footer-right a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 500;
  margin-left: 4px;
  transition: var(--transition);
  border-bottom: 1px solid transparent;
}

.footer-right a:hover {
  color: white;
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

/* ==================== SCROLLBAR ==================== */

.app-sidebar::-webkit-scrollbar,
.app-main::-webkit-scrollbar {
  width: 8px;
}

.app-sidebar::-webkit-scrollbar-track,
.app-main::-webkit-scrollbar-track {
  background: transparent;
}

.app-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.app-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.app-main::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.app-main::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .app-sidebar {
    width: 75%;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 999;
    overflow-y: auto;
    transition: all 0.3s ease;
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  }

  /* En móvil el sidebar NUNCA se colapsa - siempre muestra texto completo */
  .app-sidebar.collapsed {
    width: 75%;
    transform: translateX(-100%);
  }

  .app-sidebar.collapsed.open {
    transform: translateX(0);
  }

  /* Forzar mostrar texto en móvil incluso si está colapsado */
  .app-sidebar.collapsed .logo-name,
  .app-sidebar.collapsed .nav-text {
    display: inline-block !important;
  }

  .app-content {
    width: 100%;
  }

  .app-header {
    padding: 0 15px;
  }

  /* Mostrar botón mobile solo en mobile */
  .mobile-menu-btn,
  .mobile-menu-btn .rz-button {
    display: flex !important;
  }

  /* Ocultar info de usuario en mobile */
  .user-info {
    display: none !important;
  }

  .header-actions {
    gap: 6px;
  }

  .header-right {
    gap: 8px;
  }

  .user-dropdown {
    right: -50px;
  }

  .page-title {
    font-size: 18px;
  }

  .app-main {
    padding: 20px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .app-header {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-height);
  }

  .header-left {
    width: 100%;
    gap: 10px;
  }

  .header-right {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    flex-direction: row;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .page-title {
    font-size: 16px;
  }

  .btn-icon {
    font-size: 18px;
  }
}

/* ==================== DARK MODE ==================== */

:root[data-theme="dark"] .app-sidebar {
  background: linear-gradient(135deg, #2a2550 0%, #4a3570 100%);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
}

:root[data-theme="dark"] .app-header {
  background: linear-gradient(135deg, #2a2550 0%, #4a3570 100%);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .app-main {
/*  background: var(--background-light); */
}

:root[data-theme="dark"] .app-footer {
  background: linear-gradient(135deg, #2a2550 0%, #4a3570 100%);
  border-top-color: rgba(255, 255, 255, 0.1);
}

/* ==================== USER MENU DARK MODE ==================== */

:root[data-theme="dark"] .btn-user {
  color: rgba(255, 255, 255, 0.95);
}

:root[data-theme="dark"] .btn-user:hover {
  background-color: rgba(255, 255, 255, 0.15) !important;
}

:root[data-theme="dark"] .user-avatar {
  background: linear-gradient(
    135deg,
    rgba(124, 146, 255, 0.3) 0%,
    rgba(145, 99, 209, 0.3) 100%
  );
  border: 2px solid rgba(124, 146, 255, 0.5);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(124, 146, 255, 0.2);
}

:root[data-theme="dark"] .user-info strong {
  color: #ffffff;
  font-weight: 600;
}

:root[data-theme="dark"] .user-info small {
  color: rgba(255, 255, 255, 0.7);
}

:root[data-theme="dark"] .dropdown-arrow {
  color: rgba(255, 255, 255, 0.7);
}

:root[data-theme="dark"] .user-dropdown {
  background: linear-gradient(135deg, #2a2550 0%, #3a3060 100%);
  border: 1px solid rgba(124, 146, 255, 0.3);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.7),
    0 0 20px rgba(124, 146, 255, 0.1);
}

:root[data-theme="dark"] .dropdown-item {
  color: rgba(255, 255, 255, 0.9);
}

:root[data-theme="dark"] .dropdown-item:hover {
  background: linear-gradient(
    90deg,
    rgba(124, 146, 255, 0.2) 0%,
    rgba(145, 99, 209, 0.15) 100%
  );
  color: #ffffff;
  border-left: 3px solid var(--primary-color);
  padding-left: 13px;
}

:root[data-theme="dark"] .dropdown-item .rz-icon {
  color: rgba(124, 146, 255, 0.8);
}

:root[data-theme="dark"] .dropdown-item:hover .rz-icon {
  color: var(--primary-color);
}

:root[data-theme="dark"] .dropdown-item.logout:hover {
  background: linear-gradient(
    90deg,
    rgba(255, 85, 85, 0.15) 0%,
    rgba(220, 38, 38, 0.1) 100%
  );
  color: var(--danger-color);
  border-left-color: var(--danger-color);
}

:root[data-theme="dark"] .dropdown-item.logout:hover .rz-icon {
  color: var(--danger-color);
}

:root[data-theme="dark"] .dropdown-divider {
  border-top-color: rgba(124, 146, 255, 0.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .btn-icon {
  color: rgba(255, 255, 255, 0.9);
}

:root[data-theme="dark"] .btn-icon:hover {
  background-color: rgba(124, 146, 255, 0.2) !important;
  color: #ffffff;
}

:root[data-theme="dark"] .badge {
  background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
  box-shadow: 0 0 8px rgba(255, 85, 85, 0.4);
}

:root[data-theme="dark"] .app-main::-webkit-scrollbar-thumb {
  background: var(--border-color);
}

:root[data-theme="dark"] .app-main::-webkit-scrollbar-thumb:hover {
  background: var(--border-dark);
}


/* =============================================================================
   SUBSCRIPTION EXPIRED WALL
   Pantalla de bloqueo por suscripcion vencida (rt360-subscription-wall-*)
   ============================================================================= */

.rt360-subscription-wall {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height));
  padding: 2rem 1.25rem;
  /*background: var(--background-light);*/
}

.rt360-subscription-wall__card {
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-lg, 0 8px 32px rgba(0,0,0,.12));
  overflow: hidden;
}

.rt360-subscription-wall__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 2rem 1.5rem;
  background: linear-gradient(135deg, var(--rz-danger, #ef4444) 0%, #c0392b 100%);
  color: #fff;
}

.rt360-subscription-wall__icon {
  font-size: 3rem !important;
  width: 3rem !important;
  height: 3rem !important;
  color: rgba(255,255,255,.9);
}

.rt360-subscription-wall__title {
  color: #fff !important;
  font-size: 1.375rem !important;
  font-weight: 700 !important;
  margin: 0 !important;
  text-align: center;
}

.rt360-subscription-wall__body {
  padding: 1.75rem 2rem 2rem;
}

.rt360-subscription-wall__subtitle {
  text-align: center;
  color: var(--rz-text-secondary-color) !important;
  margin-bottom: 1.25rem !important;
}

.rt360-subscription-wall__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
  padding: 0.875rem 1rem;
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-sm, 6px);
}

.rt360-subscription-wall__meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
}

.rt360-subscription-wall__meta-label {
    font-size: 0.7rem !important;
    color: var(--rz-text-secondary-color) !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rt360-subscription-wall__meta-value {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: var(--rz-text-secondary-color) !important;
}

.rt360-subscription-wall__actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.rt360-subscription-wall__contact {
  text-align: center;
  color: var(--rz-text-secondary-color) !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
}

/* Dark mode */
:root[data-theme="dark"] .rt360-subscription-wall__meta {
  background: rgba(255, 255, 255, 0.07);
}
