/* =========================================================
   VexYra Executive
   Responsive Stylesheet
   File: assets/css/responsive.css

   Mobile sidebar:
   - Uses .active
   - No backdrop blur
   - Sidebar always stays above overlay
========================================================= */

/* =========================================================
   1. LARGE TABLETS / SMALL LAPTOPS
   Up to 1200px
========================================================= */

@media (max-width: 1200px) {
  :root {
    --sidebar-width: 225px;
  }

  .dashboard-content {
    padding: 25px;
  }

  .topbar {
    padding: 0 25px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   2. TABLETS
   Up to 992px
========================================================= */

@media (max-width: 992px) {
  :root {
    --sidebar-width: 225px;
  }

  .sidebar {
    width: var(--sidebar-width);
  }

  .main-content {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
  }

  .topbar {
    padding: 0 20px;
  }

  .dashboard-content {
    padding: 22px;
  }

  .welcome-card {
    padding: 24px;
  }

  .welcome-content h2 {
    font-size: 21px;
  }
}

/* =========================================================
   3. MOBILE / TABLET
   Up to 768px
========================================================= */

@media (max-width: 768px) {
  /* -------------------------------------------------------
     APP
  ------------------------------------------------------- */

  .app {
    display: block;
    width: 100%;
    min-height: 100vh;
  }

  /* -------------------------------------------------------
     SIDEBAR
  ------------------------------------------------------- */

  .sidebar {
    position: fixed;

    top: 0;
    left: -280px;

    width: 260px;
    height: 100vh;

    z-index: 10001;

    display: flex;
    flex-direction: column;

    overflow-y: auto;
    overflow-x: hidden;

    background: var(--surface);

    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.2);

    transition:
      left 0.25s ease,
      transform 0.25s ease;

    visibility: hidden;

    opacity: 1;

    transform: translateX(0);

    /* IMPORTANT:
       Prevent any inherited blur/filter effect */
    filter: none !important;

    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* -------------------------------------------------------
     OPEN MOBILE SIDEBAR
  ------------------------------------------------------- */

  .sidebar.active {
    left: 0;

    visibility: visible;

    opacity: 1;

    transform: translateX(0);

    z-index: 10001;

    filter: none !important;

    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* -------------------------------------------------------
     SIDEBAR INTERNAL AREAS
  ------------------------------------------------------- */

  .sidebar-top {
    width: 100%;
  }

  .sidebar-bottom {
    width: 100%;
    margin-top: auto;
  }

  /* -------------------------------------------------------
     SIDEBAR NAVIGATION
  ------------------------------------------------------- */

  .sidebar-nav {
    display: block;
    width: 100%;
  }

  .nav-section {
    display: block;
    width: 100%;
  }

  .nav-section-title {
    display: block;
  }

  .nav-link {
    display: flex;
    align-items: center;
    width: 100%;

    opacity: 1 !important;

    filter: none !important;

    transform: none;
  }

  /* -------------------------------------------------------
     MAIN CONTENT
  ------------------------------------------------------- */

  .main-content {
    width: 100%;
    min-width: 0;

    margin-left: 0;
  }

  /* -------------------------------------------------------
     TOPBAR
  ------------------------------------------------------- */

  .topbar {
    height: 68px;

    padding: 0 18px;

    position: relative;

    z-index: 1000;
  }

  /* -------------------------------------------------------
     MOBILE MENU BUTTON
  ------------------------------------------------------- */

  .mobile-menu-btn {
    width: 38px;
    height: 38px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    background: #f8fafc;

    color: var(--text-secondary);

    border: 1px solid var(--border);

    border-radius: 9px;

    font-family: inherit;
    font-size: 18px;

    cursor: pointer;

    -webkit-tap-highlight-color: transparent;

    transition:
      background 0.2s ease,
      color 0.2s ease,
      border-color 0.2s ease,
      transform 0.2s ease;
  }

  .mobile-menu-btn:hover {
    background: var(--primary-light);

    color: var(--primary);

    border-color: var(--primary-soft);
  }

  .mobile-menu-btn:active {
    transform: scale(0.95);
  }

  .mobile-menu-btn.active {
    background: var(--primary-light);

    color: var(--primary);

    border-color: var(--primary-soft);
  }

  /* -------------------------------------------------------
     PAGE HEADING
  ------------------------------------------------------- */

  .page-eyebrow {
    font-size: 8px;
  }

  .page-heading h1 {
    font-size: 19px;
  }

  /* -------------------------------------------------------
     TOPBAR ACTIONS
  ------------------------------------------------------- */

  .topbar-actions {
    gap: 3px;
  }

  .icon-btn,
  .notification-btn {
    width: 36px;
    height: 36px;
  }

  .profile-info,
  .profile-arrow {
    display: none;
  }

  .profile-trigger {
    padding-right: 2px;
  }

  /* -------------------------------------------------------
     MOBILE SIDEBAR OVERLAY
     
     IMPORTANT:
     NO backdrop-filter / blur.
  ------------------------------------------------------- */

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open::before {
    content: "";

    position: fixed;

    inset: 0;

    z-index: 10000;

    background: rgba(15, 23, 42, 0.42);

    /* Absolutely NO blur */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;

    filter: none !important;

    pointer-events: auto;
  }

  /* -------------------------------------------------------
     DASHBOARD
  ------------------------------------------------------- */

  .dashboard-content {
    padding: 20px 16px;
  }

  /* -------------------------------------------------------
     WELCOME
  ------------------------------------------------------- */

  .welcome-card {
    min-height: auto;

    padding: 22px;

    flex-direction: column;

    align-items: flex-start;

    gap: 18px;
  }

  .welcome-content h2 {
    font-size: 20px;
  }

  .welcome-content p {
    font-size: 12px;
  }

  .welcome-action {
    width: 100%;
  }

  .welcome-action .btn {
    width: 100%;
  }

  /* -------------------------------------------------------
     KPI GRID
  ------------------------------------------------------- */

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);

    gap: 12px;
  }

  .kpi-card {
    min-height: 135px;

    padding: 17px;
  }

  .kpi-value {
    font-size: 22px;
  }

  /* -------------------------------------------------------
     SECTION HEADERS
  ------------------------------------------------------- */

  .section-header {
    align-items: center;
  }

  .section-header h2,
  .card-header h2 {
    font-size: 16px;
  }

  /* -------------------------------------------------------
     ATTENTION
  ------------------------------------------------------- */

  .attention-item {
    padding: 15px;

    gap: 11px;
  }

  .attention-title-row {
    align-items: flex-start;

    flex-direction: column;

    gap: 5px;
  }

  .attention-title-row h3 {
    font-size: 12px;
  }

  .attention-meta {
    gap: 8px;
  }

  .attention-arrow {
    display: none;
  }

  /* -------------------------------------------------------
     DASHBOARD GRID
  ------------------------------------------------------- */

  .dashboard-grid {
    grid-template-columns: 1fr;

    gap: 15px;
  }

  /* -------------------------------------------------------
     HEALTH CHART
  ------------------------------------------------------- */

  .health-chart {
    height: 175px;
  }

  /* -------------------------------------------------------
     GOALS
  ------------------------------------------------------- */

  .goal-info {
    align-items: flex-start;

    flex-direction: column;

    gap: 3px;
  }

  .goal-info span {
    font-size: 9px;
  }

  /* -------------------------------------------------------
     TASKS
  ------------------------------------------------------- */

  .task-row {
    padding: 13px 15px;

    gap: 10px;
  }

  .task-status {
    font-size: 9px;
  }

  /* -------------------------------------------------------
     AI CARD
  ------------------------------------------------------- */

  .ai-card {
    padding: 20px;
  }
}

/* =========================================================
   4. SMALL MOBILE
   Up to 576px
========================================================= */

@media (max-width: 576px) {
  /* -------------------------------------------------------
     SIDEBAR
  ------------------------------------------------------- */

  .sidebar {
    width: 270px;

    left: -285px;
  }

  .sidebar.active {
    left: 0;
  }

  /* -------------------------------------------------------
     TOPBAR
  ------------------------------------------------------- */

  .topbar {
    padding: 0 13px;
  }

  .topbar-left {
    gap: 9px;
  }

  .page-eyebrow {
    display: none;
  }

  .page-heading h1 {
    font-size: 18px;
  }

  .icon-btn {
    display: none;
  }

  /* -------------------------------------------------------
     DASHBOARD
  ------------------------------------------------------- */

  .dashboard-content {
    padding: 16px 12px;
  }

  /* -------------------------------------------------------
     WELCOME
  ------------------------------------------------------- */

  .welcome-card {
    padding: 19px;

    margin-bottom: 16px;

    border-radius: 13px;
  }

  .welcome-content h2 {
    font-size: 18px;

    letter-spacing: -0.4px;
  }

  .welcome-content p {
    font-size: 11px;

    line-height: 1.65;
  }

  /* -------------------------------------------------------
     KPI CARDS
  ------------------------------------------------------- */

  .kpi-grid {
    grid-template-columns: 1fr 1fr;

    gap: 9px;

    margin-bottom: 22px;
  }

  .kpi-card {
    min-height: 125px;

    padding: 14px;

    border-radius: 11px;
  }

  .kpi-label {
    font-size: 10px;
  }

  .kpi-icon {
    width: 27px;
    height: 27px;

    font-size: 12px;
  }

  .kpi-value {
    margin-top: 11px;

    font-size: 19px;
  }

  .kpi-change {
    margin-top: 8px;

    font-size: 9px;
  }

  .kpi-change span {
    display: block;

    margin: 2px 0 0;
  }

  /* -------------------------------------------------------
     SECTION HEADER
  ------------------------------------------------------- */

  .dashboard-section {
    margin-bottom: 22px;
  }

  .section-header {
    margin-bottom: 10px;
  }

  .section-header h2,
  .card-header h2 {
    font-size: 15px;
  }

  .section-link,
  .card-link {
    font-size: 10px;
  }

  /* -------------------------------------------------------
     ATTENTION
  ------------------------------------------------------- */

  .attention-item {
    min-height: auto;

    padding: 14px 12px;

    align-items: flex-start;
  }

  .attention-indicator {
    height: 42px;
  }

  .attention-title-row h3 {
    font-size: 11px;

    line-height: 1.4;
  }

  .attention-content p {
    font-size: 9px;
  }

  .status-badge {
    font-size: 7px;
  }

  .attention-meta {
    margin-left: auto;

    align-self: center;

    font-size: 8px;
  }

  /* -------------------------------------------------------
     DASHBOARD CARDS
  ------------------------------------------------------- */

  .card-header {
    padding: 17px 15px 0;
  }

  .goal-list {
    padding: 5px 15px 10px;
  }

  /* -------------------------------------------------------
     HEALTH
  ------------------------------------------------------- */

  .health-summary {
    padding: 15px 15px 2px;
  }

  .health-summary strong {
    font-size: 27px;
  }

  .chart-wrapper {
    padding: 4px 13px 14px;
  }

  .health-chart {
    height: 145px;
  }

  .chart-labels {
    font-size: 8px;
  }

  /* -------------------------------------------------------
     GOALS
  ------------------------------------------------------- */

  .goal-item {
    padding: 13px 0;
  }

  .goal-info h3 {
    font-size: 11px;
  }

  .goal-progress {
    margin-top: 8px;
  }

  /* -------------------------------------------------------
     TASKS
  ------------------------------------------------------- */

  .task-row {
    min-height: 62px;

    padding: 12px;
  }

  .task-main h3 {
    font-size: 10px;
  }

  .task-main span {
    font-size: 8px;
  }

  .task-status {
    font-size: 8px;
  }

  /* -------------------------------------------------------
     AI
  ------------------------------------------------------- */

  .ai-card {
    padding: 18px;

    border-radius: 13px;
  }

  .ai-header {
    gap: 9px;
  }

  .ai-icon {
    width: 35px;
    height: 35px;

    border-radius: 9px;

    font-size: 16px;
  }

  .ai-eyebrow {
    font-size: 8px;
  }

  .ai-header h2 {
    font-size: 14px;
  }

  .ai-content {
    margin-top: 14px;
  }

  .ai-content p {
    font-size: 10px;

    line-height: 1.7;
  }

  .ai-recommendation {
    margin-top: 13px;

    padding: 11px 12px;
  }

  .recommendation-label {
    font-size: 7px;
  }

  .ai-recommendation p {
    font-size: 9px;

    line-height: 1.55;
  }

  .ai-link {
    margin-top: 13px;

    font-size: 10px;
  }
}

/* =========================================================
   5. VERY SMALL PHONES
   Up to 400px
========================================================= */

@media (max-width: 400px) {
  .sidebar {
    width: 260px;

    left: -275px;
  }

  .sidebar.active {
    left: 0;
  }

  .topbar {
    height: 64px;
  }

  .dashboard-content {
    padding: 13px 9px;
  }

  .mobile-menu-btn {
    width: 35px;
    height: 35px;

    font-size: 16px;
  }

  .page-heading h1 {
    font-size: 17px;
  }

  .profile-avatar {
    width: 31px;
    height: 31px;

    font-size: 10px;
  }

  .notification-btn {
    width: 34px;
    height: 34px;
  }

  .welcome-card {
    padding: 16px;
  }

  .welcome-content h2 {
    font-size: 17px;
  }

  .kpi-card {
    min-height: 118px;

    padding: 12px;
  }

  .kpi-value {
    font-size: 17px;
  }

  .kpi-change {
    font-size: 8px;
  }

  .attention-meta {
    display: none;
  }

  .task-status {
    max-width: 70px;

    white-space: normal;

    text-align: right;
  }
}

/* =========================================================
   6. EXTRA SMALL PHONES
   Up to 320px
========================================================= */

@media (max-width: 320px) {
  .sidebar {
    width: 250px;

    left: -265px;
  }

  .sidebar.active {
    left: 0;
  }

  .dashboard-content {
    padding: 10px 7px;
  }

  .topbar {
    padding: 0 9px;
  }

  .topbar-actions {
    gap: 0;
  }

  .kpi-grid {
    gap: 7px;
  }

  .kpi-card {
    padding: 10px;
  }

  .kpi-label {
    font-size: 9px;
  }

  .kpi-value {
    font-size: 15px;
  }

  .kpi-change {
    font-size: 7px;
  }

  .welcome-content h2 {
    font-size: 16px;
  }

  .attention-title-row h3 {
    font-size: 10px;
  }

  .task-main h3 {
    font-size: 9px;
  }
}

/* =========================================================
   7. MOBILE SIDEBAR SAFETY OVERRIDES
========================================================= */

@media (max-width: 768px) {
  /* -------------------------------------------------------
     SIDEBAR CLOSED
  ------------------------------------------------------- */

  .sidebar:not(.active) {
    visibility: hidden !important;

    opacity: 1 !important;

    left: -280px !important;

    transform: translateX(0) !important;

    filter: none !important;

    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* -------------------------------------------------------
     SIDEBAR OPEN
  ------------------------------------------------------- */

  .sidebar.active {
    display: flex !important;

    visibility: visible !important;

    opacity: 1 !important;

    left: 0 !important;

    transform: translateX(0) !important;

    z-index: 10001 !important;

    filter: none !important;

    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* -------------------------------------------------------
     SIDEBAR CONTENT
  ------------------------------------------------------- */

  .sidebar.active .sidebar-top,
  .sidebar.active .sidebar-nav,
  .sidebar.active .nav-section,
  .sidebar.active .nav-section-title,
  .sidebar.active .nav-link,
  .sidebar.active .sidebar-bottom {
    visibility: visible !important;

    opacity: 1 !important;

    filter: none !important;
  }

  /* -------------------------------------------------------
     NAVIGATION TEXT + ICONS
  ------------------------------------------------------- */

  .sidebar.active .nav-link,
  .sidebar.active .nav-link span,
  .sidebar.active .nav-link i,
  .sidebar.active .nav-section-title {
    opacity: 1 !important;

    filter: none !important;
  }

  /* -------------------------------------------------------
     BRAND
  ------------------------------------------------------- */

  .sidebar.active .brand,
  .sidebar.active .brand *,
  .sidebar.active .brand-logo,
  .sidebar.active .brand-text {
    opacity: 1 !important;

    filter: none !important;
  }
}
