/* Mobile CSS - Styles for screens 767px and smaller */
/* Mobile-first design with touch optimization */

/* ===== SECTION 1: HEADER (Logo + Auth Buttons) ===== */

/* Mobile header container - prevent overflow */
.container-fluid {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    overflow-x: hidden;
}

/* Header row - target the specific row with border-bottom */
.row.py-2.border-bottom .col-12 {
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
}

/* CRITICAL: Target the exact flex container with inline styles */
.row.py-2.border-bottom .col-12 .d-flex {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
    gap: 0.25rem !important;
    flex-direction: row !important; /* Force horizontal layout */
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: nowrap !important; /* Prevent wrapping */
}

/* Logo side - first div - scaled logo takes less space */
.row.py-2.border-bottom .col-12 .d-flex > div:first-child {
    flex: 0 0 auto; /* Don't grow or shrink, use natural size */
    overflow: visible; /* Allow scaled content to be visible */
    order: 1; /* Ensure logo comes first */
}

/* Buttons side - last div - takes remaining space */
.row.py-2.border-bottom .col-12 .d-flex > div:last-child {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.125rem !important;
    flex-shrink: 0 !important;
    flex-wrap: nowrap !important;
    order: 2; /* Ensure buttons come second */
    margin-left: auto; /* Push to the right side */
}

/* Logo link wrapper - ensure proper sizing */
.row.py-2.border-bottom a[href*="home"] {
    display: block;
    max-width: 100%;
    overflow: hidden;
}

/* Logo container - keep same styling as desktop but prevent cutoff */
.logo-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

/* Mobile: Add scale to logo text while preserving base skew */
.logo-text {
    /* Base.css provides: skewX(-8deg) */
    /* Mobile adds: scale(0.8) - half of previous 1.6 */
    transform: scale(0.8) skewX(-8deg) !important; /* Combine scale with skew */
    transform-origin: left center; /* Scale from left side */
}

/* .logo-grok and .logo-tagline use base.css styles - no mobile overrides */

/* Ensure the scaled logo doesn't create layout issues */
.row.py-2.border-bottom a[href*="home"] {
    display: block;
    width: fit-content;
    overflow: visible; /* Allow scaled content to be visible */
}

/* ===== SECTION 2: NAVIGATION BAR ===== */

/* Navigation container - keep horizontal but allow wrapping */
.row.py-2:not(.border-bottom) .d-flex {
    flex-direction: row !important; /* Horizontal layout */
    flex-wrap: wrap !important;
    gap: 0.5rem;
    justify-content: space-between !important;
}

/* Navigation left side - horizontal from left edge */
.row.py-2:not(.border-bottom) .d-flex > div:first-child {
    order: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem; /* Tighter spacing */
    justify-content: flex-start !important; /* Start from left edge */
}

/* Home button and navigation elements - compact mobile version */
.row.py-2:not(.border-bottom) .btn {
    min-height: 28px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.2;
    margin-left: 0 !important;
}

/* Icon-only navigation buttons - hide text spans */
.row.py-2:not(.border-bottom) .btn .btn-text {
    display: none !important;
}

/* Navigation buttons - compact sizing for mobile */
.row.py-2:not(.border-bottom) a.btn {
    min-width: 28px;
    padding: 0.3rem 0.5rem;
}

/* Vertical separator - even more compact on mobile */
.row.py-2:not(.border-bottom) .border-start {
    margin-left: 0.25rem !important;
    margin-right: 0.25rem !important;
}

/* Action buttons (Practice, Edit, Delete, etc.) - more compact on mobile */
.row.py-2:not(.border-bottom) .d-flex.gap-2 {
    gap: 0.25rem !important; /* Reduce gap between action buttons */
}

.row.py-2:not(.border-bottom) .d-flex.gap-2 .btn {
    padding: 0.25rem 0.4rem !important; /* More compact padding */
    font-size: 0.75rem !important;
    min-height: auto !important;
    box-shadow: none !important;
}

.row.py-2:not(.border-bottom) .d-flex.gap-2 .btn i {
    margin-right: 0.25rem !important; /* Reduce icon spacing */
    font-size: 0.9rem !important;
}

/* Remove margin from icons in action buttons */
.row.py-2:not(.border-bottom) .d-flex.gap-2 .bi {
    margin-right: 0.25rem !important;
}

.row.py-2:not(.border-bottom) a.btn[href*="topic_detail"] i {
    font-size: 0.85rem !important;
    margin-right: 0.25rem !important;
    position: static !important;
    transform: none !important;
}

/* Navigation right side (workspace selector) */
.vendor-workspace-selector {
    order: 2;
    align-self: center;
    display: flex;
    justify-content: flex-end; /* Align to right */
}

/* Workspace selector buttons - compact mobile version */
.vendor-workspace-selector .btn-group {
    display: flex;
    gap: 0.25rem; /* Tighter spacing */
}

.vendor-workspace-selector .btn {
    min-height: 28px; /* Reduced from 32px to match nav buttons */
    padding: 0.3rem 0.5rem; /* Match nav button padding */
    font-size: 0.8rem; /* Smaller text */
    line-height: 1.2;
}

/* Workspace collapsed button - more compact */
.vendor-workspace-selector .workspace-collapsed .btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
}

/* ===== SECTION 3: CONTENT LAYOUT ===== */

/* Mobile content - stack sidebar below main content */
.row .col-lg-4 {
    order: 2;
    margin-top: 1rem;
    height: auto !important;
    max-height: 300px;
}

.row .col-lg-8, .row .col-lg-12 {
    order: 1;
}

/* Mobile header - make responsive */
.mobile-header {
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-header .d-flex:first-child {
    justify-content: space-between;
    width: 100%;
}

.mobile-header .d-flex:last-child {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Mobile home layout - stack sidebar below main content */
.home-content {
    flex-direction: column;
}

.home-sidebar {
    height: auto;
    max-height: none;
    order: 2; /* Move sidebar below main content */
    margin-top: 1rem;
}

.home-main {
    order: 1; /* Main content first */
}

/* Mobile curriculum sections - optimize for touch */
.recent-visits-container {
    max-height: 250px;
    overflow-y: auto;
}

/* Mobile button optimizations - balanced touch targets */
.btn {
    min-height: 40px; /* Reduced from 44px */
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
}

.btn-sm {
    min-height: 36px; /* Reduced from 40px */
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
}

/* Icon-only buttons for mobile - compact and touch-friendly */
.btn-icon-only {
    min-width: 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-icon-only i {
    font-size: 1.1rem;
}

/* Mobile-specific: Hide text, show only icons for certain buttons */
.btn-mobile-icon-only .btn-text {
    display: none;
}

.btn-mobile-icon-only {
    min-width: 28px;
    width: 28px;
    height: 28px;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    flex-shrink: 0;
    margin: 0 !important; /* Remove all margins */
}

.btn-mobile-icon-only i {
    margin: 0 !important;
    font-size: 0.8rem;
}

/* Ensure header buttons stay horizontal and compact - specific targeting */
.row.py-2.border-bottom form {
    display: inline-flex !important;
    margin: 0 !important;
}

/* Remove all margins from header buttons to prevent wrapping */
.row.py-2.border-bottom .btn {
    margin: 0 !important;
}

.row.py-2.border-bottom .ms-2 {
    margin-left: 0 !important;
}

.row.py-2.border-bottom .me-2 {
    margin-right: 0 !important;
}

/* Hide user greeting on very small screens */
.row.py-2.border-bottom .me-2.d-none.d-sm-inline {
    display: none !important;
}

/* Mobile message positioning - full width */
#message-container {
    position: fixed;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 1060;
    pointer-events: none;
}

.toast-message {
    min-width: auto;
    max-width: 100%;
    width: 100%;
    pointer-events: auto;
    margin-bottom: 0.5rem;
}

/* Minimized messages - show enough for icon visibility on mobile */
.toast-message.minimized {
    transform: translateX(calc(100% - 30px)) !important; /* Show 32px for icon */
    height: 48px !important;
    overflow: hidden !important;
}

/* Mobile form controls - optimized for touch */
.form-control,
.form-select {
    min-height: 44px;
    font-size: 1.1rem;
    padding: 0.75rem;
}

/* Mobile navigation - larger touch targets */
.nav-link {
    padding: 1rem;
    font-size: 1rem;
}

/* Mobile card adjustments */
.card {
    margin-bottom: 1rem;
    border-radius: 0.5rem;
}

.card-body {
    padding: 1rem;
}

/* Mobile typography - larger for readability */
h1 { font-size: 1.5rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

/* Mobile spacing optimizations */
.py-2 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.p-3 {
    padding: 1rem !important;
}

/* Mobile table responsiveness */
.table-responsive {
    border: 0;
    border-radius: 0;
}

.table {
    font-size: 0.9rem;
}

/* Mobile hover effects - disabled for touch */
.card-hover:hover {
    transform: none;
}

/* Mobile utility classes */
.mobile-hide {
    display: none !important;
}

.mobile-stack {
    flex-direction: column !important;
}

.mobile-center {
    text-align: center !important;
}

.mobile-full-width {
    width: 100% !important;
}

/* Mobile scrollable containers */
.mobile-scroll {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
}

/* Mobile icon adjustments */
.bi {
    font-size: 1.1em;
}

/* Mobile list adjustments */
.list-group-item {
    padding: 1rem;
    border-radius: 0.375rem !important;
    margin-bottom: 0.5rem;
    border: 1px solid #dee2e6 !important;
}

/* Mobile breadcrumb simplification */
.breadcrumb {
    font-size: 0.85rem;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

/* Mobile alert adjustments */
.alert {
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 0.95rem;
}

/* Mobile message adjustments */
.message-container {
    bottom: 10px;
    right: 10px;
    left: 10px;
}

.toast-message {
    min-width: auto;
    max-width: 100%;
}

/* Mobile form optimizations */
.form-control, .form-select {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 0.6rem;
}

/* Mobile card spacing */
.card {
    margin-bottom: 1rem;
    border-radius: 0.5rem;
}

/* Mobile navigation improvements */
.nav-tabs .nav-link {
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
}

/* Mobile text size adjustments */
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }

/* Mobile spacing utilities */
.mobile-spacing > * {
    margin-bottom: 0.75rem;
}

.mobile-spacing > *:last-child {
    margin-bottom: 0;
}

/* ===== HOME PAGE SEARCH ===== */

/* Position search container to the left on mobile */
.home-search-container {
    justify-content: flex-start !important;
    width: 100% !important;
    padding-left: 0.75rem !important;
}

/* Update search input placeholder and width on mobile */
.home-search-input {
    width: auto !important;
    flex: 1 !important;
    max-width: 250px !important;
}

/* Change placeholder text on mobile using CSS (requires JavaScript for full support) */
/* We'll use JavaScript to change the placeholder text */

/* Mobile curriculum cards - apply max-width for all mobile screens */
.curriculum-card {
    max-width: 400px !important;
}

.curriculum-card .card {
    max-width: 100%;
}

/* ===== INLINE MESSAGE BUTTONS ===== */

/* Fix spacing for inline buttons in toast messages on mobile - ONLY when expanded */
.toast-message:not(.minimized) .message-text .purchase-btn-inline,
.toast-message:not(.minimized) .message-text .btn-sm,
.toast-message:not(.minimized) .btn-sm {
    display: inline !important;
    margin: 0 2px !important;
    padding: 2px 6px !important;
    line-height: 1.2 !important;
    vertical-align: middle !important;
    font-size: 0.8rem !important;
    border-width: 1px !important;
}

/* Force message text to be completely inline - ONLY when expanded */
.toast-message:not(.minimized) .message-text {
    display: inline !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Remove ALL spacing from message text elements - ONLY when expanded */
.toast-message:not(.minimized) .message-text * {
    margin: 0 !important;
    padding: 0 !important;
}

/* Compact card body on mobile - ONLY when expanded */
.toast-message:not(.minimized) .card-body {
    padding: 0.5rem !important;
}

/* Reduce icon header margin - ONLY when expanded */
.toast-message:not(.minimized) .flex-grow-1 > div:first-child {
    margin-bottom: 0.25rem !important;
}

/* Keep everything on one line if possible - ONLY when expanded */
.toast-message:not(.minimized) .flex-grow-1 {
    display: block !important;
}

/* Minimized messages - restore normal spacing */
.toast-message.minimized .message-text {
    display: none !important; /* Hide all text in minimized state */
}

.toast-message.minimized .card-body {
    padding: 0.25rem !important; /* Reduce padding for more compact look */
    width: 12px !important; /* Show only icon width on mobile */
}

/* Override the translateX to show less of the card on mobile */
.toast-message.minimized {
    transform: translateX(calc(100% - 20px)) !important; /* Show only 15px instead of 20px */
    height: 32px !important; /* Reduce height on mobile */
    min-height: 32px !important;
}

/* Hide the close button in minimized state on mobile */
.toast-message.minimized .message-close-btn {
    display: none !important;
}




