/* * Core Layout Styles
 * File: /public/assets/css/core/layout.css
 */

/* --- VARIABLES FALLBACK --- */
:root {
    --container-max: 1100px; 
    --sidebar-width: 230px; /* Reduced from 280px */
    --header-height: 70px;
    
    /* Z-Index Layer Management */
    --z-header: 1000;
    --z-overlay: 1050;
    --z-sidebar: 1060;
    --z-mobile-menu-btn: 1100;
}

/* --- APP SHELL (Grid Layout) --- */
.app-layout {
    display: grid;
    grid-template-columns: 100%;
    min-height: calc(100vh - var(--header-height));
    width: 100%;
}

/* Main Layout Classes */
.layout-grid,
.layout-full,
.layout-dashboard {
    max-width: var(--container-max);
    margin: 0 auto;
    width: 100%;
    padding: 0px; 
    padding-top:16px;
    padding-bottom: 16px;
    box-sizing: border-box; 
}

/* Sidebar & Content Grid (Desktop) */
.layout-grid {
    gap: 1rem; 
}

/* Full Width Layout */
.layout-full {
    display: block; 
}

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

@media (min-width: 992px) {
    .layout-grid {
        display: grid;
        grid-template-columns: var(--sidebar-width) 1fr;
        align-items: start; 
    }

    .app-sidebar {
        grid-column: 1 / 2;
        padding-right: 0;
        z-index: 10;
    }

    .desktop-hidden {
        display: none !important;
    }
}

/* Auth Layout */
.layout-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background-color: var(--bg-body);
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

/* --- APP HEADER --- */
.app-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 16px; /* Matching the layout padding */
    transition: top 0.3s ease;
}

.header-container {
    max-width: var(--container-max);
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
}

.header-start, .header-end {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-center {
    flex: 1;
    max-width: 500px;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    max-width: 100%;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    padding: var(--space-sm);
    background: none;
    border: none;
    cursor: pointer;
    margin-left: var(--space-xs);
    position: relative;
    z-index: var(--z-mobile-menu-btn);
    transition: color 0.2s;
}
.mobile-menu-btn:hover {
    color: var(--text-main);
}
.mobile-menu-btn i {
    pointer-events: none;
    transition: transform 0.3s ease;
}
.mobile-menu-btn .fa-xmark {
    transform: rotate(90deg);
}

/* Search Form */
.search-form {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.search-form input {
    width: 100%;
    height: 40px;
    padding-left: 36px;
    padding-right: 12px;
    background: var(--bg-body);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

/* --- USER MENU & DROPDOWN --- */
.user-menu-wrapper { position: relative; }
.user-menu-btn {
    padding: 2px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: none;
    cursor: pointer;
}
.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-border);
    display: block;
}

/* Common Dropdown Style */
.user-dropdown-menu, .notification-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: var(--z-overlay);
    overflow: hidden;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-menu-btn[aria-expanded="true"] + .user-dropdown-menu,
.notification-dropdown.active {
    display: block;
}

.user-dropdown-menu { width: 240px; padding: var(--space-sm); }

.dropdown-header { 
    padding: var(--space-sm) var(--space-md); 
    border-bottom: 1px solid var(--border-subtle); 
    margin-bottom: var(--space-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dropdown-header strong { display: block; color: var(--text-main); }
.dropdown-header span { font-size: 0.85rem; color: var(--text-muted); }

.dropdown-item {
    display: flex; align-items: center; gap: var(--space-sm); padding: 0.6rem var(--space-md);
    color: var(--text-muted); font-size: 0.9rem; border-radius: var(--radius-sm); text-decoration: none;
}
.dropdown-item:hover { background: var(--bg-body); color: var(--primary); }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: var(--space-sm) 0; }

/* --- NOTIFICATION DROPDOWN --- */
.notification-wrapper { position: relative; }
.notification-dropdown { width: 320px; padding: 0; }

.notification-list-mini {
    max-height: 300px;
    overflow-y: auto;
}

.notif-item-mini {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
    color: var(--text-main);
    transition: background 0.2s;
}
.notif-item-mini:hover { background: var(--bg-surface-hover); }
.notif-item-mini.unread { background: var(--primary-soft); }

.notif-icon-mini {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bg-body);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; color: var(--text-muted);
    flex-shrink: 0;
}

.notif-text-mini { font-size: 0.85rem; line-height: 1.4; }

.empty-state-mini {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dropdown-footer {
    padding: 0.8rem;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-body);
}
.view-all-link { font-size: 0.85rem; font-weight: 600; color: var(--primary); text-decoration: none; }
.view-all-link:hover { text-decoration: underline; }

/* Action Icons */
.action-icons { display: flex; gap: var(--space-xs); }
.icon-btn {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); border-radius: var(--radius-sm); background: none; border: none; cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--bg-body); color: var(--text-main); }
.badge-dot {
    position: absolute; top: 8px; right: 8px; width: 8px; height: 8px;
    background: var(--danger); border: 2px solid var(--bg-surface); border-radius: 50%;
}

@media (max-width: 991px) {
    .mobile-menu-btn { display: block; }
    .header-center { display: none; }
    .hidden-mobile { display: none !important; }

    /* Mobile Layout Fix */
    .layout-grid, .layout-full, .layout-dashboard { 
        padding: 16px; /* Consistent padding */
        display: flex; 
        flex-direction: column;
        gap: var(--space-lg);
    }

    .layout-grid .app-main { order: 1; }
    
    .layout-grid .app-sidebar, 
    .layout-dashboard .app-sidebar,
    .app-sidebar.desktop-hidden {
        order: 2;
        display: block !important; 
        width: 100%;
    }

    .notification-dropdown {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        border-left: none; border-right: none;
    }
}

/* --- APP FOOTER --- */
.app-footer { 
    background: var(--bg-surface); 
    border-top: 1px solid var(--border-subtle); 
    padding: var(--space-xl) 0; 
    margin-top: auto; 
    font-size: 0.95rem; 
    color: var(--text-muted);
}

.footer-container {
    max-width: var(--container-max); 
    margin: 0 auto; 
    padding: 0 16px; /* Matching layout padding */
    display: grid;
    gap: var(--space-xl);
    grid-template-columns: 1fr;
}

@media (min-width: 768px) { 
    .footer-container { 
        grid-template-columns: 1.5fr 1fr;
        align-items: start;
    } 
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.footer-brand { 
    display: flex; 
    align-items: center; 
    gap: var(--space-sm); 
    color: var(--text-main);
    font-size: 1.1rem;
}

.brand-icon-sm { color: var(--primary); }

.footer-desc {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 450px; 
    margin: 0;
    word-break: break-word; 
}

.footer-copyright { font-size: 0.85rem; color: var(--text-dim); }

.footer-widgets {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    align-items: flex-start;
}

@media (min-width: 768px) {
    .footer-widgets {
        align-items: flex-end; 
        text-align: right;
    }
}

.footer-nav-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

@media (min-width: 768px) {
    .footer-nav-grid { justify-content: flex-end; }
}

.footer-link { 
    color: var(--text-main); 
    font-weight: 500; 
    text-decoration: none; 
    transition: color 0.2s;
}
.footer-link:hover { color: var(--primary); }

.footer-social {
    display: flex; 
    align-items: center; 
    gap: 0.75rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-body);
    color: var(--text-muted);
    font-size: 1.2rem;
    border: 1px solid var(--border-subtle);
    transition: all 0.2s ease;
    text-decoration: none;
}

.social-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* --- GLOBAL UTILITIES --- */
.d-flex { display: flex !important; }
.d-block { display: block !important; }
.d-none { display: none !important; }
.d-inline-block { display: inline-block !important; }

.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-wrap { flex-wrap: wrap !important; }

.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }

.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }

.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }

.m-0 { margin: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.ms-3 { margin-left: 1rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }

.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.text-decoration-none { text-decoration: none !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

/* Colors */
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-main { color: var(--text-main) !important; }
.bg-surface { background-color: var(--bg-surface) !important; }
.bg-primary-soft { background-color: var(--primary-soft) !important; }

/* Typography */
.font-weight-bold { font-weight: 700 !important; }
.h5 { font-size: 1.15rem; font-weight: 700; line-height: 1.4; }
.h6 { font-size: 1rem; font-weight: 600; line-height: 1.4; }
.small, .text-sm { font-size: 0.875rem !important; }
.text-xs { font-size: 0.75rem !important; }

/* Borders & Radius */
.border { border: 1px solid var(--border-subtle) !important; }
.border-bottom { border-bottom: 1px solid var(--border-subtle) !important; }
.rounded { border-radius: var(--radius-sm) !important; }
.rounded-circle { border-radius: 50% !important; }

/* Position */
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }

/* PWA Banner */
.pwa-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 2000;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 var(--space-md);
    box-shadow: var(--shadow-md);
    animation: slideDown 0.3s ease-out;
}

.pwa-banner.active {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pwa-content {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
}

.pwa-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.pwa-text-group { display: flex; flex-direction: column; }
.pwa-title { font-size: 0.9rem; font-weight: 700; color: var(--text-main); }
.pwa-desc { font-size: 0.75rem; color: var(--text-muted); }

.pwa-actions { display: flex; align-items: center; gap: var(--space-sm); }

.btn-pwa-install {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-pwa-install:hover { background: var(--primary-hover); }

.btn-pwa-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}
.btn-pwa-close:hover { color: var(--text-main); }

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

body.has-pwa-banner { padding-top: 60px; }
body.has-pwa-banner .app-header { top: 60px; }
@media (min-width: 992px) {
    body.has-pwa-banner .app-sidebar {
        top: calc(60px + var(--header-height) + var(--space-lg));
    }
}

/* --- RESPONSIVE FIXES (MOBİL DÜZENLEMELER) --- */
@media (max-width: 576px) {
    .brand-text { font-size: 1rem; }
    .header-container { gap: 0.5rem; }
    .header-start, .header-end { gap: 0.5rem; }
    .icon-btn { width: 32px; height: 32px; }
}

/* --- SIDEBAR MENÜ DÜZENLEMESİ (KURUMSAL SAYFALAR İÇİN) --- */
.list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    border-radius: var(--radius-sm);
}

.list-group-flush { border-radius: 0; }

.list-group-item {
    position: relative;
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-main);
    text-decoration: none;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    margin-bottom: -1px;
}

.list-group-item:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.list-group-item:last-child { margin-bottom: 0; border-bottom-right-radius: inherit; border-bottom-left-radius: inherit; }

.list-group-item:hover {
    z-index: 1;
    background-color: var(--bg-surface-hover);
    text-decoration: none;
    color: var(--text-main);
}

.list-group-item.active {
    z-index: 2;
    color: #fff;
    background-color: var(--primary);
    border-color: var(--primary);
}

.list-group-item-action {
    width: 100%;
    color: var(--text-main);
    text-align: inherit;
}