/**
 * Global Responsive Styles for Performer Finder
 * Ensures consistent responsive behavior across all pages
 */

/* ========================================
   BASE RESPONSIVE STYLES
   ======================================== */

/* Ensure viewport is set correctly */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Prevent horizontal scrolling */
body {
    overflow-x: hidden;
    width: 100%;
}

/* Container responsive padding */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Images responsive by default */
img {
    max-width: 100%;
    height: auto;
}

/* Tables scroll on mobile */
table {
    width: 100%;
    overflow-x: auto;
    display: block;
}

@media (min-width: 768px) {
    table {
        display: table;
    }
}

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

/* Base font size adjustments */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.125rem;
    }
}

/* ========================================
   COMMON COMPONENTS
   ======================================== */

/* Hero sections */
.hero,
.applications-hero,
.edit-hero,
.dashboard-hero,
.events-hero {
    padding: 2rem 1rem !important;
}

/* Note: Exclude .home-page .hero-title to not interfere with front page hero */
.dashboard-container .hero-title,
.applications-hero .hero-title,
.edit-hero .hero-title,
.events-hero .hero-title {
    font-size: 2rem !important;
}

.dashboard-container .hero-subtitle,
.applications-hero .hero-subtitle,
.edit-hero .hero-subtitle,
.events-hero .hero-subtitle {
    font-size: 1rem !important;
}

@media (min-width: 768px) {
    .hero,
    .applications-hero,
    .edit-hero,
    .dashboard-hero,
    .events-hero {
        padding: 3rem 1rem !important;
    }

    .dashboard-container .hero-title,
    .applications-hero .hero-title,
    .edit-hero .hero-title,
    .events-hero .hero-title {
        font-size: 2.5rem !important;
    }

    .dashboard-container .hero-subtitle,
    .applications-hero .hero-subtitle,
    .edit-hero .hero-subtitle,
    .events-hero .hero-subtitle {
        font-size: 1.125rem !important;
    }
}

/* Cards and grids */
.events-grid,
.applications-grid,
.performers-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .events-grid,
    .applications-grid,
    .performers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .events-grid,
    .applications-grid,
    .performers-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Form rows */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

/* Buttons responsive */
.button,
.btn {
    width: 100%;
    justify-content: center;
}

@media (min-width: 640px) {
    .button,
    .btn {
        width: auto;
    }
}

/* Form actions */
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .form-actions {
        flex-direction: row;
        justify-content: center;
    }
}

/* ========================================
   NAVIGATION & HEADER
   ======================================== */

/* Mobile menu */
@media (max-width: 768px) {
    .main-navigation {
        display: none;
    }

    .main-navigation.mobile-active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        z-index: 9999;
        padding: 1rem;
    }

    .mobile-menu-toggle {
        display: block !important;
    }
}

/* ========================================
   DASHBOARD LAYOUTS
   ======================================== */

.dashboard-stats,
.applications-stats {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
    .dashboard-stats,
    .applications-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Dashboard sidebar */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .dashboard-layout {
        flex-direction: row;
    }

    .dashboard-sidebar {
        width: 250px;
        flex-shrink: 0;
    }

    .dashboard-main {
        flex: 1;
    }
}

/* ========================================
   INBOX / MESSAGING
   ======================================== */

.inbox-container {
    display: flex;
    flex-direction: column;
    height: auto;
}

@media (min-width: 768px) {
    .inbox-container {
        flex-direction: row;
        height: 600px;
    }

    .inbox-sidebar {
        width: 350px;
        border-right: 1px solid #e5e7eb;
    }

    .inbox-main {
        flex: 1;
    }
}

/* Hide sidebar on mobile when conversation is open */
@media (max-width: 767px) {
    .inbox-sidebar.conversation-active {
        display: none;
    }

    .inbox-main.conversation-active {
        display: flex;
    }
}

/* ========================================
   PROFILE PAGES
   ======================================== */

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .profile-header {
        flex-direction: row;
        text-align: left;
        align-items: flex-start;
    }
}

.profile-avatar {
    width: 100px;
    height: 100px;
}

@media (min-width: 768px) {
    .profile-avatar {
        width: 150px;
        height: 150px;
    }
}

/* ========================================
   MODALS
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 100%;
    width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 640px) {
    .modal-content {
        max-height: 100vh;
        border-radius: 0;
        width: 100%;
    }
}

/* ========================================
   TABLES
   ======================================== */

@media (max-width: 768px) {
    /* Stack table cells vertically on mobile */
    table.responsive-table {
        border: 0;
    }

    table.responsive-table thead {
        display: none;
    }

    table.responsive-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 1rem;
    }

    table.responsive-table td {
        display: block;
        text-align: right;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f3f4f6;
    }

    table.responsive-table td:last-child {
        border-bottom: 0;
    }

    table.responsive-table td:before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
    }
}

/* ========================================
   SPACING UTILITIES
   ======================================== */

/* Mobile spacing adjustments */
@media (max-width: 768px) {
    .section {
        padding: 2rem 1rem;
    }

    .card,
    .form-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

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

/* ========================================
   HIDE/SHOW UTILITIES
   ======================================== */

.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: block;
    }
}

/* ========================================
   TOUCH TARGETS
   ======================================== */

/* Ensure touch targets are at least 44x44px on mobile */
@media (max-width: 768px) {
    button,
    a.button,
    .btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
    }

    /* Increase checkbox/radio tap targets */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
}

/* ========================================
   BREAKPOINT HELPERS
   ======================================== */

/*
Common breakpoints:
- 640px  (sm) - Large phones
- 768px  (md) - Tablets
- 1024px (lg) - Laptops
- 1280px (xl) - Desktops
*/

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

/* Focus indicators more visible on mobile */
@media (max-width: 768px) {
    *:focus {
        outline: 3px solid #667eea;
        outline-offset: 2px;
    }
}

/* ========================================
   PERFORMANCE
   ======================================== */

/* Reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

@media print {
    /* Hide non-essential elements when printing */
    .no-print,
    .mobile-menu-toggle,
    .form-actions,
    button,
    .btn {
        display: none !important;
    }

    /* Expand containers */
    .container {
        max-width: 100%;
        padding: 0;
    }

    /* Remove backgrounds */
    * {
        background: white !important;
        color: black !important;
    }
}

/* ========================================
   LANDSCAPE MOBILE
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    /* Reduce vertical spacing in landscape */
    .hero,
    .applications-hero,
    .edit-hero {
        padding: 1rem !important;
    }

    .dashboard-container .hero-title,
    .applications-hero .hero-title,
    .edit-hero .hero-title {
        font-size: 1.5rem !important;
    }
}
