/**
 * GlamourSchedule - Mobile Friendly & Readability Improvements
 * Version: 1.0
 * Optimized for touch devices and improved legibility
 */

/* ============================================================
   BASE MOBILE IMPROVEMENTS
   ============================================================ */

/* Prevent zoom on input focus (iOS) */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="search"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Improve touch targets */
a, button, input, select, textarea, [role="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Minimum touch target size (44x44px recommended by Apple/Google) */
@media (max-width: 768px) {
    button,
    .btn,
    a.btn,
    input[type="submit"],
    input[type="button"],
    [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ============================================================
   TYPOGRAPHY - IMPROVED READABILITY
   ============================================================ */

/* Base font size adjustments */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    line-height: 1.6;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Better paragraph spacing */
p {
    margin-bottom: 1rem;
}

/* Headings with better mobile scaling */
h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.25;
    margin-bottom: 0.875rem;
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

h4 {
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
    line-height: 1.35;
    margin-bottom: 0.625rem;
}

/* Better text contrast for readability */
.text-muted,
.text-light,
[class*="text-secondary"] {
    color: #525252 !important;
}

/* ============================================================
   MOBILE CONTAINER & SPACING
   ============================================================ */

@media (max-width: 768px) {
    /* Reduce horizontal padding on mobile */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Better section spacing */
    section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    /* Card spacing */
    .card,
    [class*="card"] {
        padding: 1rem;
        margin-bottom: 1rem;
    }
}

/* ============================================================
   FORMS - MOBILE OPTIMIZED
   ============================================================ */

/* Better input styling */
input,
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 16px;
    border-radius: 8px;
    border: 2px solid var(--input-border, var(--theme-border, #e5e5e5));
    background: var(--input-bg, var(--theme-bg, #fff));
    color: var(--input-text, var(--theme-text, #000));
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--input-border, var(--theme-border, #000));
    box-shadow: 0 0 0 3px rgba(var(--theme-text-rgb, 0, 0, 0), 0.1);
}

/* Form labels */
label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
}

/* Form groups spacing */
.form-group {
    margin-bottom: 1.25rem;
}

/* Error states */
.error,
.is-invalid,
input.error,
select.error {
    border-color: #dc2626 !important;
}

.error-message,
.invalid-feedback {
    color: #dc2626;
    font-size: 0.8125rem;
    margin-top: 0.375rem;
}

/* ============================================================
   BUTTONS - TOUCH FRIENDLY
   ============================================================ */

.btn,
button,
[role="button"],
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: 2px solid transparent;
}

/* Primary button */
.btn-primary,
button.primary {
    background: var(--btn-bg, var(--theme-text, #000));
    color: var(--btn-text, var(--theme-bg, #fff));
    border-color: var(--btn-border, var(--theme-text, #000));
}

.btn-primary:hover,
.btn-primary:focus,
button.primary:hover {
    background: var(--btn-hover-bg, #333);
    border-color: var(--btn-hover-bg, #333);
}

/* Secondary button */
.btn-secondary,
button.secondary {
    background: var(--theme-bg, #fff);
    color: var(--theme-text, #000);
    border-color: var(--theme-text, #000);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: var(--card-bg, #f5f5f5);
}

/* Full width buttons on mobile */
@media (max-width: 480px) {
    .btn-block-mobile,
    .btn-full-mobile {
        width: 100%;
    }
}

/* ============================================================
   NAVIGATION - MOBILE FRIENDLY
   ============================================================ */

@media (max-width: 768px) {
    /* Mobile nav improvements */
    nav {
        padding: 0.75rem 1rem;
    }

    .nav-links {
        gap: 0.5rem;
    }

    .nav-links a {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }

    /* Hamburger menu touch target */
    .menu-toggle,
    .hamburger {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
    }
}

/* ============================================================
   CARDS & CONTENT BLOCKS
   ============================================================ */

.card,
.content-block,
.box {
    background: var(--card-bg, var(--theme-bg, #fff));
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

@media (max-width: 768px) {
    .card,
    .content-block {
        border-radius: 12px;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        padding: 1.25rem;
    }

    .card-body {
        padding: 1rem;
    }
}

/* ============================================================
   TABLES - MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    /* Stack tables on very small screens */
    .table-stack {
        display: block;
    }

    .table-stack thead {
        display: none;
    }

    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
        width: 100%;
    }

    .table-stack tr {
        margin-bottom: 1rem;
        background: var(--card-bg, var(--theme-bg, #fff));
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        padding: 1rem;
    }

    .table-stack td {
        padding: 0.5rem 0;
        border: none;
        text-align: left;
    }

    .table-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        margin-bottom: 0.25rem;
        color: #737373;
        font-size: 0.8125rem;
    }
}

/* ============================================================
   IMAGES - MOBILE OPTIMIZED
   ============================================================ */

img {
    max-width: 100%;
    height: auto;
}

/* Lazy loading placeholder */
img[loading="lazy"] {
    background: #f5f5f5;
}

/* Better image aspect ratios */
.img-cover {
    object-fit: cover;
}

.img-contain {
    object-fit: contain;
}

/* ============================================================
   GRID - MOBILE FIRST
   ============================================================ */

.grid {
    display: grid;
    gap: 1rem;
}

/* Single column on mobile */
@media (max-width: 640px) {
    .grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Two columns on tablet */
@media (min-width: 641px) and (max-width: 1024px) {
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Full grid on desktop */
@media (min-width: 1025px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   FLEX UTILITIES - MOBILE FRIENDLY
   ============================================================ */

.flex-col-mobile {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .flex-col-mobile {
        flex-direction: row;
    }
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ============================================================
   MODAL & POPUP - MOBILE FRIENDLY
   ============================================================ */

@media (max-width: 768px) {
    .modal-content,
    .popup-content {
        width: calc(100% - 2rem);
        max-width: 100%;
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        border-radius: 16px;
    }

    .modal-header,
    .popup-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: inherit;
        z-index: 1;
    }

    .modal-body,
    .popup-body {
        padding: 1rem;
    }

    .modal-footer,
    .popup-footer {
        padding: 1rem;
        position: sticky;
        bottom: 0;
        background: inherit;
    }
}

/* ============================================================
   LISTS - IMPROVED READABILITY
   ============================================================ */

ul, ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Checklist style */
.checklist {
    list-style: none;
    padding-left: 0;
}

.checklist li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.checklist li::before {
    content: "✓";
    color: #10b981;
    font-weight: 700;
    flex-shrink: 0;
}

/* ============================================================
   ALERTS & NOTIFICATIONS
   ============================================================ */

.alert,
.notification,
.notice {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.alert-success { background: #f0fdf4; border-left: 4px solid #10b981; color: #166534; }
.alert-warning { background: #fffbeb; border-left: 4px solid #f59e0b; color: #92400e; }
.alert-error { background: #fef2f2; border-left: 4px solid #ef4444; color: #991b1b; }
.alert-info { background: #eff6ff; border-left: 4px solid #3b82f6; color: #1e40af; }

/* ============================================================
   BREADCRUMBS - MOBILE
   ============================================================ */

@media (max-width: 768px) {
    .breadcrumb {
        font-size: 0.8125rem;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
    }

    .breadcrumb::-webkit-scrollbar {
        display: none;
    }
}

/* ============================================================
   FOOTER - MOBILE FRIENDLY
   ============================================================ */

@media (max-width: 768px) {
    footer {
        padding: 2rem 1rem;
    }

    .footer-grid {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .footer-links {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile,
    .desktop-only {
        display: none !important;
    }
}

/* Show only on mobile */
@media (min-width: 769px) {
    .mobile-only,
    .show-mobile {
        display: none !important;
    }
}

/* Text alignment responsive */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center;
    }
}

/* Spacing responsive */
@media (max-width: 768px) {
    .p-mobile-1 { padding: 0.5rem; }
    .p-mobile-2 { padding: 1rem; }
    .p-mobile-3 { padding: 1.5rem; }

    .m-mobile-0 { margin: 0; }
    .mb-mobile-1 { margin-bottom: 0.5rem; }
    .mb-mobile-2 { margin-bottom: 1rem; }
}

/* ============================================================
   SCROLL IMPROVEMENTS
   ============================================================ */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Scroll snap for horizontal scrolling */
.scroll-snap-x {
    scroll-snap-type: x mandatory;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.scroll-snap-x > * {
    scroll-snap-align: start;
}

/* Hide scrollbars but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ============================================================
   LOADING & SKELETON STATES
   ============================================================ */

.skeleton {
    background: linear-gradient(90deg, #f5f5f5 25%, #e5e5e5 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================ */

/* Focus visible for keyboard users */
:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    .btn,
    button {
        border-width: 3px;
    }

    input,
    select,
    textarea {
        border-width: 3px;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .no-print,
    nav,
    .nav,
    footer,
    .btn,
    button,
    .modal,
    .popup {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    a {
        text-decoration: underline;
        color: #000;
    }
}
