/**
 * Pixel Council - Comprehensive Responsive CSS
 * Mobile-first approach with breakpoints:
 * - xs: 0-575px (Mobile)
 * - sm: 576-767px (Mobile Landscape)
 * - md: 768-991px (Tablet)
 * - lg: 992-1199px (Desktop)
 * - xl: 1200px+ (Large Desktop)
 */

/* ======================
   GLOBAL RESPONSIVE UTILITIES
   ====================== */

/* Prevent horizontal scroll on all devices */
html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    overflow-x: hidden;
    max-width: 100%;
    position: relative;
}

/* Ensure all containers respect viewport width */
* {
    max-width: 100%;
}

img, svg, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Container responsive padding */
@media (max-width: 767px) {
    .container, .events-container, .logos-container, .about-content, .features-section {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Responsive text sizing */
@media (max-width: 991px) {
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.75rem !important;
    }
    
    h3 {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 575px) {
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
}

/* ======================
   HEADER & NAVIGATION RESPONSIVE
   ====================== */

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #1e293b;
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 991px) {
    header {
        padding: 1rem !important;
        margin: 1rem !important;
    }
    
    .header-container {
        flex-wrap: wrap;
        position: relative;
    }
    
    .mobile-menu-toggle {
        display: block;
        order: 3;
        transition: color 0.3s ease;
    }
    
    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }
    
    .logo {
        order: 1;
        flex: 1;
    }
    
    nav {
        order: 4;
        width: 100%;
        margin-top: 1rem;
        display: none !important;
        flex-direction: column;
        gap: 0.5rem;
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transition: opacity 0.3s ease, max-height 0.3s ease;
    }
    
    nav.mobile-active {
        display: flex !important;
        opacity: 1;
        max-height: 1000px;
    }
    
    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }
    
    .nav-links a {
        display: block;
        padding: 0.75rem 1rem;
        border-radius: 0.375rem;
    }
    
    .auth-buttons {
        order: 2;
        gap: 0.5rem;
    }
    
    .btn-sign-in,
    .btn-sign-up {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 575px) {
    .auth-buttons {
        flex-direction: column;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .auth-buttons a {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .logo-text span:first-child {
        font-size: 0.75rem !important;
    }
    
    .logo {
        font-size: 1rem !important;
    }
}

/* ======================
   FOOTER RESPONSIVE
   ====================== */

@media (max-width: 991px) {
    .footer-content {
        grid-template-columns: 1fr 1fr !important;
        gap: 2rem !important;
    }
}

@media (max-width: 575px) {
    footer {
        padding: 2rem 1rem !important;
    }
    
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-form button {
        width: 100%;
    }
    
    .social-links {
        justify-content: center;
    }
}

/* ======================
   HERO SECTIONS RESPONSIVE
   ====================== */

@media (max-width: 991px) {
    .hero-section,
    .events-hero,
    .logos-hero {
        padding: 3rem 1rem !important;
    }
    
    .hero-content h1,
    .events-hero h1,
    .logos-hero h1 {
        font-size: 2rem !important;
    }
    
    .hero-content p,
    .events-hero p {
        font-size: 1rem !important;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-buttons a {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 575px) {
    .hero-section,
    .events-hero,
    .logos-hero {
        padding: 2rem 1rem !important;
    }
    
    .hero-content h1,
    .events-hero h1,
    .logos-hero h1 {
        font-size: 1.75rem !important;
        margin-bottom: 1rem !important;
    }
}

/* ======================
   SEARCH & FILTER BARS RESPONSIVE
   ====================== */

@media (max-width: 991px) {
    .search-filter-bar {
        padding: 1rem !important;
    }
    
    .search-row {
        flex-direction: column;
        gap: 0.75rem !important;
    }
    
    .search-input-wrapper {
        min-width: 100% !important;
        width: 100%;
    }
    
    .category-select,
    .filter-select {
        width: 100%;
        min-width: 100% !important;
    }
    
    .view-toggle {
        width: 100%;
        justify-content: center;
    }
}

/* ======================
   CARD GRIDS RESPONSIVE
   ====================== */

@media (max-width: 1199px) {
    .features-grid,
    .logos-grid,
    .events-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 767px) {
    .features-grid,
    .logos-grid,
    .events-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Logo cards specific */
@media (max-width: 575px) {
    .logo-card {
        padding: 1rem !important;
    }
    
    .logo-image {
        height: 120px !important;
    }
}

/* Event cards specific */
@media (max-width: 575px) {
    .event-card {
        padding: 1rem !important;
    }
    
    .event-image {
        height: 150px !important;
    }
}

/* ======================
   ADMIN PANEL RESPONSIVE
   ====================== */

/* Sidebar toggle for mobile */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1050;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@media (max-width: 991px) {
    .sidebar {
        position: fixed !important;
        left: -250px !important;
        top: 0;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s ease;
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    }

    /* Support admin/editor layouts that toggle `.show` on mobile */
    .sidebar.show {
        left: 0 !important;
    }
    
    .sidebar.mobile-active {
        left: 0 !important;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* Overlay for mobile sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
}

/* Admin tables responsive */
@media (max-width: 991px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-table {
        min-width: 600px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.5rem !important;
        font-size: 0.875rem !important;
    }
}

/* Admin cards responsive */
@media (max-width: 767px) {
    .stats-grid,
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    
    .stat-card {
        padding: 1rem !important;
    }
}

/* Admin forms responsive */
@media (max-width: 767px) {
    .form-row {
        flex-direction: column !important;
    }
    
    .form-group {
        width: 100% !important;
    }
    
    .btn-group {
        flex-direction: column !important;
    }
    
    .btn-group .btn {
        width: 100% !important;
    }
}

/* ======================
   EDITOR PORTAL RESPONSIVE
   ====================== */

@media (max-width: 991px) {
    .editor-sidebar {
        left: -250px !important;
        transition: left 0.3s ease;
    }
    
    .editor-sidebar.mobile-active {
        left: 0 !important;
    }
    
    .editor-content {
        margin-left: 0 !important;
    }
}

/* Editor table actions */
@media (max-width: 767px) {
    .action-buttons {
        flex-direction: column !important;
        gap: 0.25rem !important;
    }
    
    .action-buttons .btn {
        width: 100% !important;
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
    }
}

/* ======================
   CUSTOMER PORTAL RESPONSIVE
   ====================== */

@media (max-width: 991px) {
    .customer-navbar {
        padding: 0.5rem 1rem !important;
    }
    
    .customer-sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 1040;
    }
    
    .customer-sidebar.mobile-active {
        left: 0;
    }
    
    .customer-main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Customer cards */
@media (max-width: 767px) {
    .collections-grid,
    .submissions-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ======================
   FORMS & INPUTS RESPONSIVE
   ====================== */

@media (max-width: 575px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    .form-control {
        padding: 0.75rem !important;
    }
}

/* ======================
   MODAL DIALOGS RESPONSIVE
   ====================== */

@media (max-width: 767px) {
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100% - 1rem) !important;
    }
    
    .modal-header {
        padding: 1rem !important;
    }
    
    .modal-body {
        padding: 1rem !important;
    }
    
    .modal-footer {
        padding: 1rem !important;
        flex-direction: column !important;
    }
    
    .modal-footer .btn {
        width: 100% !important;
        margin: 0.25rem 0 !important;
    }
}

/* ======================
   AUTHENTICATION PAGES RESPONSIVE
   ====================== */

@media (max-width: 991px) {
    .auth-container {
        padding: 2rem 1rem !important;
    }
    
    .auth-card {
        padding: 2rem 1.5rem !important;
    }
}

@media (max-width: 575px) {
    .auth-container {
        padding: 1rem !important;
        min-height: auto !important;
    }
    
    .auth-card {
        padding: 1.5rem 1rem !important;
        min-height: auto !important;
    }
    
    .auth-logo {
        font-size: 1.25rem !important;
    }
}

/* ======================
   DETAIL PAGES RESPONSIVE
   ====================== */

/* Logo Detail */
@media (max-width: 991px) {
    .logo-detail-container {
        padding: 1rem !important;
    }
    
    .logo-preview-section {
        padding: 2rem 1rem !important;
    }
    
    .download-section {
        flex-direction: column !important;
    }
    
    .download-btn {
        width: 100% !important;
    }
    
    .logo-detail-content {
        gap: 1.5rem !important;
    }
}

@media (max-width: 575px) {
    .logo-detail-grid {
        grid-template-columns: 1fr !important;
    }
    
    .logo-preview {
        height: 200px !important;
    }
    
    .logo-detail-hero {
        padding: 0.75rem !important;
    }
    
    .logo-detail-breadcrumb {
        gap: 0.25rem !important;
    }
    
    /* Prevent horizontal scroll from wide elements */
    .logo-detail-page * {
        max-width: 100%;
    }
    
    .logo-detail-page img,
    .logo-detail-page svg {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Event Detail */
@media (max-width: 991px) {
    .event-detail-container {
        flex-direction: column !important;
    }
    
    .event-sidebar {
        width: 100% !important;
    }
    
    .event-main {
        width: 100% !important;
    }
}

/* ======================
   SUBMIT FORMS RESPONSIVE
   ====================== */

@media (max-width: 991px) {
    .submit-container {
        padding: 2rem 1rem !important;
    }
    
    .submit-form {
        padding: 2rem 1.5rem !important;
    }
}

@media (max-width: 767px) {
    .submit-tabs {
        flex-direction: column !important;
    }
    
    .submit-tab {
        width: 100% !important;
    }
}

@media (max-width: 575px) {
    .submit-container {
        padding: 1rem !important;
    }
    
    .submit-form {
        padding: 1.5rem 1rem !important;
    }
    
    .file-upload-area {
        padding: 2rem 1rem !important;
    }
    
    .submit-btn,
    .submit-form button[type="submit"] {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }
}

/* ======================
   PAGINATION RESPONSIVE
   ====================== */

@media (max-width: 575px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center !important;
        gap: 0.25rem !important;
    }
    
    .pagination .page-link {
        padding: 0.375rem 0.75rem !important;
        font-size: 0.875rem !important;
    }
}

/* ======================
   UTILITY CLASSES
   ====================== */

/* Responsive display utilities */
.d-mobile-none {
    display: none;
}

@media (min-width: 768px) {
    .d-mobile-none {
        display: block;
    }
    
    .d-desktop-none {
        display: none;
    }
}

/* Responsive spacing */
@media (max-width: 767px) {
    .mt-mobile-2 {
        margin-top: 1rem !important;
    }
    
    .mb-mobile-2 {
        margin-bottom: 1rem !important;
    }
    
    .px-mobile-1 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

/* Responsive flex utilities */
@media (max-width: 767px) {
    .flex-mobile-column {
        flex-direction: column !important;
    }
    
    .flex-mobile-wrap {
        flex-wrap: wrap !important;
    }
}

/* ======================
   PRINT STYLES
   ====================== */

@media print {
    .sidebar,
    .navbar,
    header,
    footer,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        width: 100% !important;
    }
    
    body {
        background: white !important;
    }
}
