/* BYF Mühendislik - Mobile-First Responsive Design */

/* ===================================
   MOBILE FIRST APPROACH (320px base)
   =================================== */

/* Base styles are already mobile-first in style.css */

/* ===================================
   TABLET: 768px
   =================================== */
@media (min-width: 768px) {
    /* Grid Layouts */
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Dashboard */
    .dashboard-content {
        grid-template-columns: 2fr 1fr;
    }
    
    /* Forms */
    .form-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-3);
    }
    
    /* Cards */
    .card {
        padding: var(--spacing-4);
    }
    
    /* Navigation */
    .nav-menu {
        display: flex;
        flex-direction: row;
        gap: var(--spacing-3);
    }
    
    /* Section Headers */
    .section-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Buttons */
    .btn-group {
        flex-direction: row;
    }
    
    /* Footer */
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Services Grid - 2 columns on tablet */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .service-card-content {
        padding: 1.5rem;
    }
    
    .service-card-content h3 {
        font-size: 1.25rem;
    }
    
    .service-card-image {
        height: 180px;
    }
}

/* ===================================
   DESKTOP SMALL: 1024px
   =================================== */
@media (min-width: 1024px) {
    /* Grid Layouts */
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Navigation */
    .main-nav {
        display: flex !important;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
    
    /* Hero Section */
    .hero-container {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-5);
    }
    
    /* Footer */
    .footer-container {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Services Grid - 3 columns on desktop */
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .service-card-content {
        padding: 2rem;
    }
    
    .service-card-image {
        height: 190px;
    }
}

/* ===================================
   DESKTOP LARGE: 1440px
   =================================== */
@media (min-width: 1440px) {
    /* Extra Large Grids */
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Services Grid - Max 3 columns even on large screens */
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
    
    /* Increased Spacing */
    .section-padding {
        padding: var(--spacing-5) 0;
    }
}

/* ===================================
   MAX-WIDTH MEDIA QUERIES
   (For specific mobile adjustments)
   =================================== */

/* Mobile Portrait - Max 480px */
@media (max-width: 480px) {
    /* Container tighter padding on very small screens */
    .container {
        padding-left: var(--spacing-2);
        padding-right: var(--spacing-2);
    }
    
    /* Typography */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
    
    /* Service Cards */
    .service-card-image {
        height: 140px;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        padding: var(--spacing-2) var(--spacing-3);
        font-size: 0.9rem;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    /* Cards */
    .card {
        padding: var(--spacing-2);
    }
    
    /* Stats */
    .stat-number {
        font-size: 1.5rem;
    }
    
    /* Tables */
    .table-responsive {
        font-size: 0.8rem;
    }
    
    /* Forms */
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* Auth Pages */
    .auth-card {
        padding: var(--spacing-3);
    }
    
    /* Hero Buttons */
    .hero-buttons {
        flex-direction: column;
        gap: var(--spacing-2);
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    /* Reduce main content padding */
    .main-content {
        padding-top: 90px;
    }
    
    /* Services Grid - Single column on mobile */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .service-card-content {
        padding: 1.25rem;
    }
    
    .service-card-content h3 {
        font-size: 1.15rem;
    }
    
    .service-card-content p {
        font-size: 0.9rem;
    }
    
    .service-card-image {
        height: 160px;
    }
    
    
    /* Section padding reduction */
    .section-padding {
        padding: 1.5rem 0;
    }
}

/* Tablet Portrait - Max 768px */
@media (max-width: 768px) {
    /* Navigation Mobile */
    .main-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Main content padding adjustment */
    .main-content {
        padding-top: 100px;
    }
    
    /* Dashboard */
    .dashboard-content {
        grid-template-columns: 1fr;
    }
    
    /* Service Items */
    .service-item,
    .firm-item,
    .document-item {
        flex-direction: column;
        gap: var(--spacing-2);
    }
    
    /* Quick Actions */
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    /* Filter Grid */
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    /* Section Headers */
    .section-header {
        flex-direction: column;
        gap: var(--spacing-2);
        align-items: flex-start;
    }
    
    .section-header .btn {
        width: 100%;
    }
    
    /* Footer */
    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-bottom .footer-container {
        flex-direction: column;
        gap: var(--spacing-2);
    }
    
    /* Modal */
    .modal-content {
        margin: var(--spacing-2);
        padding: var(--spacing-3);
    }
    
    /* Images - ensure they don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Videos and iframes */
    iframe,
    video {
        max-width: 100%;
    }
    
    /* Tables wrapper for horizontal scroll */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Very Small Mobile - Max 360px */
@media (max-width: 360px) {
    /* Container */
    .container {
        padding-left: var(--spacing-2);
        padding-right: var(--spacing-2);
    }
    
    /* Typography */
    h1 { font-size: 1.375rem; }
    h2 { font-size: 1.125rem; }
    
    /* Buttons */
    .btn {
        padding: var(--spacing-2);
        font-size: 0.8rem;
    }
    
    /* Stats */
    .stat-card {
        padding: var(--spacing-2);
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
}

/* ===================================
   ORIENTATION SPECIFIC
   =================================== */

/* Landscape on Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-nav {
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .hero-section {
        padding: var(--spacing-3) 0;
    }
    
    .dashboard-header {
        padding: var(--spacing-3) 0;
    }
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
    /* Hide Interactive Elements */
    .navbar,
    .footer,
    .btn,
    .action-btn,
    .mobile-menu-toggle,
    .user-dropdown {
        display: none !important;
    }
    
    /* Reset Container */
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    /* Adjust Cards */
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
        page-break-inside: avoid;
    }
    
    /* Links */
    a {
        color: var(--dark-text);
        text-decoration: underline;
    }
    
    /* Typography */
    body {
        color: #000;
        background: #fff;
    }
}

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

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --primary-dark: #0000cc;
        --secondary-color: #ffcc00;
        --success-color: #008000;
        --warning-color: #ff6600;
        --danger-color: #ff0000;
        --border-color: #000000;
    }
    
    .btn {
        border-width: 3px;
    }
    
    .card {
        border: 2px solid var(--border-color);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===================================
   UTILITY CLASSES - RESPONSIVE
   =================================== */

/* Display Utilities */
.d-mobile-only {
    display: block;
}

.d-tablet-up {
    display: none;
}

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

.d-desktop-only {
    display: none;
}

@media (min-width: 1024px) {
    .d-desktop-only {
        display: block;
    }
}

/* Text Alignment Responsive */
.text-center-mobile {
    text-align: center;
}

@media (min-width: 768px) {
    .text-center-mobile {
        text-align: left;
    }
}

/* ===================================
   COMMON GRID RESPONSIVE PATTERNS
   =================================== */

/* 2-Column to 1-Column on Mobile */
.grid-2-1-responsive,
.contact-container,
.about-grid,
.dashboard-content,
.service-request-layout,
.blog-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .grid-2-1-responsive,
    .contact-container,
    .about-grid,
    .dashboard-content,
    .service-request-layout,
    .blog-layout {
        grid-template-columns: 2fr 1fr;
        gap: 3rem;
    }
}

/* Equal 2-Column to 1-Column on Mobile */
.grid-equal-2-responsive,
.form-row,
.values-grid,
.service-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid-equal-2-responsive,
    .form-row,
    .values-grid,
    .service-features {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* 3-Column Responsive Grid */
.grid-3-responsive {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid-3-responsive {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* 4-Column Responsive Grid */
.grid-4-responsive {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

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

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

@media (min-width: 1440px) {
    .grid-4-responsive {
        grid-template-columns: repeat(4, 1fr);
    }
}