/**
 * FONLABENI.TR - Global Responsive CSS
 * Mobile-First Approach
 * Breakpoints: 480px / 768px / 1024px / 1280px
 */

/* ============================================
   CSS VARIABLES
============================================ */
:root {
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;
    
    /* Container */
    --container-max: 1280px;
    --gutter: 16px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-drawer-overlay: 400;
    --z-drawer: 500;
    --z-modal: 600;
    --z-toast: 700;
    
    /* Touch target */
    --touch-target: 44px;
    
    /* Colors - Primary */
    --color-primary: #262e54;
    --color-primary-light: #3a4470;
    --color-primary-dark: #1a1f3a;
    
    /* Safe area for iOS */
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

/* Tablet breakpoint */
@media (min-width: 768px) {
    :root {
        --gutter: 24px;
    }
}

/* Desktop breakpoint */
@media (min-width: 1024px) {
    :root {
        --gutter: 32px;
    }
}

/* ============================================
   RESET & BASE
============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

/* CRITICAL: Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Body scroll lock when drawer/modal is open */
body.scroll-locked {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Prevent content shift when scrollbar disappears */
body.scroll-locked {
    padding-right: var(--scrollbar-width, 0px);
}

/* ============================================
   IMAGES & MEDIA
============================================ */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
    display: block;
}

img {
    image-rendering: -webkit-optimize-contrast;
}

/* Aspect ratio containers */
.aspect-square { aspect-ratio: 1 / 1; }
.aspect-video { aspect-ratio: 16 / 9; }
.aspect-portrait { aspect-ratio: 3 / 4; }

.aspect-square img,
.aspect-video img,
.aspect-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   CONTAINER SYSTEM
============================================ */
.container {
    width: min(100% - 2 * var(--gutter), var(--container-max));
    margin-inline: auto;
}

.container-sm { --container-max: 640px; }
.container-md { --container-max: 768px; }
.container-lg { --container-max: 1024px; }
.container-xl { --container-max: 1280px; }
.container-2xl { --container-max: 1536px; }
.container-full { --container-max: 100%; }

/* ============================================
   GRID SYSTEM
============================================ */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

/* Auto-fit grids */
.grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.grid-auto-fill {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

/* Product/Card grid - Responsive columns */
.grid-cards {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 columns */
}

@media (min-width: 481px) {
    .grid-cards {
        gap: 16px;
    }
}

@media (min-width: 768px) {
    .grid-cards {
        grid-template-columns: repeat(3, 1fr); /* Tablet: 3 columns */
        gap: 20px;
    }
}

@media (min-width: 1024px) {
    .grid-cards {
        grid-template-columns: repeat(4, 1fr); /* Desktop: 4 columns */
    }
}

@media (min-width: 1280px) {
    .grid-cards {
        grid-template-columns: repeat(5, 1fr); /* Large: 5 columns */
    }
}

/* Lawyer/Profile grid */
.grid-profiles {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr; /* Mobile: 1 column */
}

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

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

/* Fixed column grids */
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

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

@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
    .lg\:grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
}

/* ============================================
   FLEXBOX UTILITIES
============================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* ============================================
   OFF-CANVAS DRAWER
============================================ */
/* Overlay */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-drawer-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Drawer */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 85vw);
    height: 100%;
    height: 100dvh;
    background: #fff;
    z-index: var(--z-drawer);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.drawer.active {
    transform: translateX(0);
}

/* Left drawer variant */
.drawer-left {
    right: auto;
    left: 0;
    transform: translateX(-100%);
}

.drawer-left.active {
    transform: translateX(0);
}

/* Drawer header */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

/* Drawer content */
.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

/* Drawer footer */
.drawer-footer {
    padding: var(--spacing-md);
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    padding-bottom: calc(var(--spacing-md) + var(--safe-area-inset-bottom));
}

/* Drawer close button */
.drawer-close {
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f3f4f6;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-fast);
    color: #374151;
}

.drawer-close:hover {
    background: #e5e7eb;
}

/* ============================================
   MOBILE NAVIGATION MENU
============================================ */
.mobile-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-item {
    border-bottom: 1px solid #f3f4f6;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    min-height: var(--touch-target);
    transition: background var(--transition-fast);
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    background: #f9fafb;
}

.mobile-nav-link.active {
    color: var(--color-primary);
    background: #eff6ff;
}

.mobile-nav-link i {
    width: 20px;
    text-align: center;
}

/* Accordion submenu */
.mobile-nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
    background: #f9fafb;
}

.mobile-nav-submenu.open {
    max-height: 500px;
}

.mobile-nav-submenu .mobile-nav-link {
    padding-left: calc(var(--spacing-md) + 28px);
    font-weight: 400;
    font-size: 0.9375rem;
}

/* ============================================
   STICKY BOTTOM BAR (Mobile)
============================================ */
.sticky-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: var(--spacing-sm) var(--spacing-md);
    padding-bottom: calc(var(--spacing-sm) + var(--safe-area-inset-bottom));
    z-index: var(--z-fixed);
    display: flex;
    gap: var(--spacing-sm);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

/* Hide on desktop */
@media (min-width: 1024px) {
    .sticky-bottom-bar {
        display: none;
    }
}

/* Add bottom padding to body when sticky bar is present */
.has-sticky-bottom {
    padding-bottom: calc(70px + var(--safe-area-inset-bottom));
}

@media (min-width: 1024px) {
    .has-sticky-bottom {
        padding-bottom: 0;
    }
}

/* ============================================
   BUTTONS
============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    min-height: var(--touch-target);
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 36px;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.875rem;
}

.btn-lg {
    min-height: 52px;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1rem;
}

/* ============================================
   FORMS - Responsive
============================================ */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    min-height: var(--touch-target);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-lg);
    background: #fff;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(38, 46, 84, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Inline form on desktop */
.form-inline {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

@media (min-width: 768px) {
    .form-inline {
        flex-direction: row;
        align-items: flex-end;
    }
    
    .form-inline .form-group {
        margin-bottom: 0;
        flex: 1;
    }
}

/* ============================================
   CARDS
============================================ */
.card {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-image {
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.card:hover .card-image img {
    transform: scale(1.05);
}

.card-body {
    padding: var(--spacing-md);
}

@media (min-width: 768px) {
    .card-body {
        padding: var(--spacing-lg);
    }
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: #1f2937;
    line-height: 1.4;
}

@media (min-width: 768px) {
    .card-title {
        font-size: 1.125rem;
    }
}

.card-text {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

/* ============================================
   SIDEBAR FILTER (Mobile: Off-canvas)
============================================ */
.filter-sidebar {
    display: none;
}

@media (min-width: 1024px) {
    .filter-sidebar {
        display: block;
        position: sticky;
        top: calc(var(--spacing-lg) + 70px);
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
}

/* Mobile filter button */
.filter-toggle-btn {
    display: flex;
}

@media (min-width: 1024px) {
    .filter-toggle-btn {
        display: none;
    }
}

/* ============================================
   TWO COLUMN LAYOUT (Product Detail etc.)
============================================ */
.layout-two-col {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

@media (min-width: 1024px) {
    .layout-two-col {
        flex-direction: row;
        gap: var(--spacing-xl);
    }
    
    .layout-two-col .col-main {
        flex: 1;
    }
    
    .layout-two-col .col-side {
        width: 380px;
        flex-shrink: 0;
    }
    
    .layout-two-col .col-side.sticky {
        position: sticky;
        top: calc(var(--spacing-lg) + 70px);
        align-self: flex-start;
    }
}

/* ============================================
   RESPONSIVE UTILITIES
============================================ */
/* Hide/Show by breakpoint */
.hidden { display: none !important; }
.block { display: block !important; }

@media (max-width: 479px) {
    .hidden-xs { display: none !important; }
}

@media (min-width: 480px) and (max-width: 767px) {
    .hidden-sm { display: none !important; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .hidden-md { display: none !important; }
}

@media (min-width: 1024px) and (max-width: 1279px) {
    .hidden-lg { display: none !important; }
}

@media (min-width: 1280px) {
    .hidden-xl { display: none !important; }
}

/* Show only on specific breakpoints */
@media (max-width: 767px) {
    .desktop-only { display: none !important; }
}

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

@media (max-width: 1023px) {
    .lg-only { display: none !important; }
}

@media (min-width: 1024px) {
    .mobile-tablet-only { display: none !important; }
}

/* ============================================
   TEXT UTILITIES
============================================ */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   SPACING UTILITIES
============================================ */
.p-0 { padding: 0; }
.p-xs { padding: var(--spacing-xs); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mx-auto { margin-inline: auto; }
.my-auto { margin-block: auto; }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

/* ============================================
   SECTION SPACING
============================================ */
.section {
    padding-block: var(--spacing-xl);
}

@media (min-width: 768px) {
    .section {
        padding-block: var(--spacing-2xl);
    }
}

@media (min-width: 1024px) {
    .section {
        padding-block: var(--spacing-3xl);
    }
}

/* ============================================
   HAMBURGER MENU ICON
============================================ */
.hamburger {
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #374151;
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================
   PANEL RESPONSIVE ADJUSTMENTS
============================================ */
@media (max-width: 1023px) {
    .panel-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        height: 100dvh;
        z-index: var(--z-drawer);
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }
    
    .panel-sidebar.active {
        transform: translateX(0);
    }
    
    .panel-content {
        margin-left: 0 !important;
    }
}

/* ============================================
   PRINT STYLES
============================================ */
@media print {
    .drawer,
    .drawer-overlay,
    .sticky-bottom-bar,
    .hamburger,
    .filter-toggle-btn {
        display: none !important;
    }
    
    body {
        overflow: visible !important;
    }
}

/* ============================================
   EKSİK BREAKPOINTS - 360px / 1440px / 1728px
   CTO Standardı: 360/480/768/1024/1280/1440/1728
============================================ */

/* ========== 360px - Küçük Mobil (iPhone SE, Galaxy S) ========== */
@media (max-width: 360px) {
    :root {
        --gutter: 8px;
    }
    
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .hide-360 { display: none !important; }
    
    .fn-page-header h1 {
        font-size: 1.25rem;
    }
    
    /* Card'lar sıkıştır */
    .card, .panel-card {
        border-radius: 10px;
    }
    
    .card-body, .panel-card-body {
        padding: 10px;
    }
    
    /* Butonlar */
    .btn, button {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    /* Form elementleri */
    input, select, textarea {
        font-size: 16px; /* iOS zoom engelleme */
    }
}

/* ========== 1440px - Büyük Masaüstü ========== */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    :root {
        --gutter: 24px;
    }
    
    .grid-auto-fill-lg {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* ========== 1728px - Ultra Geniş / 5K ========== */
@media (min-width: 1728px) {
    .container {
        max-width: 1600px;
    }
    
    :root {
        --spacing-lg: 32px;
        --spacing-xl: 48px;
    }
}

/* ============================================
   FLUID TYPOGRAPHY - clamp() ile responsive yazı boyutu
============================================ */
.text-fluid-xs   { font-size: clamp(11px, 0.5vw + 9px, 13px); }
.text-fluid-sm   { font-size: clamp(12px, 0.5vw + 10px, 14px); }
.text-fluid-base { font-size: clamp(14px, 0.5vw + 12px, 16px); }
.text-fluid-lg   { font-size: clamp(16px, 0.8vw + 12px, 20px); }
.text-fluid-xl   { font-size: clamp(18px, 1vw + 12px, 24px); }
.text-fluid-2xl  { font-size: clamp(20px, 1.5vw + 12px, 30px); }
.text-fluid-3xl  { font-size: clamp(24px, 2vw + 12px, 36px); }

/* ============================================
   CLS KORUMA - Layout Shift önleme
============================================ */
.img-placeholder {
    aspect-ratio: 16 / 9;
    background: #f1f5f9;
    display: block;
}
.img-placeholder-square { aspect-ratio: 1; }
.img-placeholder-portrait { aspect-ratio: 3 / 4; }

img:not([width]):not([height]) {
    height: auto;
    max-width: 100%;
}

/* ============================================
   ERİŞİLEBİLİRLİK
============================================ */
@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;
    }
}

:focus-visible {
    outline: 2px solid #1e3a5f;
    outline-offset: 2px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 9999;
    padding: 12px 24px;
    background: #1e3a5f;
    color: white;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

/* ============================================
   SAFE AREA - iOS Notch / Dynamic Island
============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
    .sticky-bottom-bar,
    .fixed-bottom {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
