/* ============================================
   LAYOUT.CSS - Grid, Container, Page Layout
   ============================================ */

/* Container & Grid System */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Mobil görünümde container tam genişlik */
@media (max-width: 991px) {
    .container {
        max-width: 100vw !important;
        width: 100vw !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

/* Main App Section */
.app-section {
    display: none;
    min-height: 100vh;
    flex-direction: row;
    position: relative; /* Mobile menu toggle için referans noktası */
}

.app-section.active {
    display: flex;
}

/* Mobil görünümde app-section tam genişlik */
@media (max-width: 991px) {
    .app-section {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Main Content Area */
.main-content,
.main-content-wrapper {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    margin-left: 180px;
    min-height: 100vh;
    background: #f5f5f5;
    box-sizing: border-box;
    position: relative; /* Mobile menu toggle için referans noktası */
}

/* Masaüstü görünümde main-content margin güncellemesi */
@media (min-width: 992px) {
    .main-content,
    .main-content-wrapper {
        margin-left: 200px;
        width: calc(100% - 200px);
        max-width: calc(100vw - 200px);
    }
}

/* Mobil görünümde main-content tam genişlik */
@media (max-width: 991px) {
    .main-content,
    .main-content-wrapper {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        box-sizing: border-box !important;
    }
}

.section-content {
    margin-top: 0;
    padding-top: 0;
    display: none;
    width: 100%;
    min-height: auto; /* 100% kaldırıldı - mobilde parent height yok, içeriğe göre yükseklik */
    opacity: 1;
    visibility: visible;
    position: relative;
    z-index: 1;
    height: auto;
    overflow: visible;
}

.section-content.active,
.section-content[style*="display: block"] {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
}

/* Sidebar - Standardized */
.sidebar {
    width: 180px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem;
    padding-bottom: 3.5rem;
    overflow-y: auto;
    position: fixed;
    height: 100vh;
    top: 20px;
    left: 0;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

/* Masaüstü görünümde sidebar genişliği ve scrollbar */
@media (min-width: 992px) {
    .sidebar {
        width: 200px;
    }
    
    /* Scrollbar varsayılan olarak gizli */
    .sidebar::-webkit-scrollbar {
        width: 6px;
    }
    
    .sidebar::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .sidebar::-webkit-scrollbar-thumb {
        background: transparent;
        border-radius: 3px;
        transition: background 0.3s ease;
    }
    
    /* Hover ile scrollbar görünür */
    .sidebar:hover::-webkit-scrollbar-thumb {
        background: rgba(243, 146, 0, 0.3);
    }
    
    .sidebar:hover::-webkit-scrollbar-thumb:hover {
        background: rgba(243, 146, 0, 0.5);
    }
    
    /* Firefox için scrollbar */
    .sidebar {
        scrollbar-width: thin;
        scrollbar-color: transparent transparent;
    }
    
    .sidebar:hover {
        scrollbar-color: rgba(243, 146, 0, 0.3) transparent;
    }
}

/* Mobil görünümde sidebar tam ekran ve gizli */
@media (max-width: 991px) {
    .sidebar {
        width: 280px !important;
        height: 100vh !important;
        top: 0 !important;
        padding-bottom: 4rem !important;
    }
}

/* Mobil görünümde sidebar varsayılan olarak gizli */
@media (max-width: 991px) {
    .sidebar:not(.open) {
        transform: translateX(-100%) !important;
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
    }
    
    .main-content,
    .main-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

.sidebar-logo {
    width: 100%;
    max-width: 160px;
    height: auto;
    margin-bottom: 0.75rem;
    margin-left: auto;
    position: relative;
    margin-right: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2d3d;
    background: transparent;
    border-radius: 12px;
    padding: 0.4rem;
    box-shadow: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.sidebar-logo:hover {
    opacity: 0.8;
}

.sidebar-logo svg {
    width: 100%;
    height: auto;
    max-width: 160px;
    max-height: 50px;
    display: block;
}

.sidebar-logo::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: linear-gradient(to right, transparent, #f39200 20%, #f39200 80%, transparent);
    animation: menuLinePulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(243, 146, 0, 0.5);
}

@keyframes menuLinePulse {
    0%, 100% {
        opacity: 0.6;
        width: 30px;
        box-shadow: 0 0 8px rgba(243, 146, 0, 0.5);
    }
    50% {
        opacity: 1;
        width: 50px;
        box-shadow: 0 0 12px rgba(243, 146, 0, 0.8);
    }
}

.mobile-logo {
    display: none;
    width: 100%;
    max-width: 180px;
    height: auto;
    margin: 0 auto 1.5rem;
    padding: 0.75rem;
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.mobile-logo:hover {
    opacity: 0.8;
}

.mobile-logo svg {
    width: 100%;
    height: auto;
    max-height: 50px;
}

.sidebar-title {
    display: none;
    line-height: 1.3;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    flex: 1;
    padding-top: 0.5rem;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-bottom {
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
}

.nav-section-label {
    font-size: 0.55rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 0.5rem;
    margin-bottom: 0.4rem;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    height: 38px;
    border-radius: 8px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    padding: 0 0.5rem;
    position: relative;
    background: transparent;
}

.nav-item:hover {
    background: rgba(243, 146, 0, 0.1);
    color: #f39200;
}

.nav-item.active {
    background: linear-gradient(135deg, #f39200 0%, #ff6b00 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(243, 146, 0, 0.3);
}

.nav-item.active .nav-item-icon {
    color: white !important;
}

.nav-item-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item-text {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.nav-item-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Tüm Tablolar menü öğesi için özel stil */
.nav-item[title="Tüm Tablolar"] .nav-item-icon {
    font-size: 1.1rem;
}

.nav-item[title="Tüm Tablolar"]:hover .nav-item-icon {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Admin menüsünde Tüm Tablolar görünürlüğü */
.nav-section .nav-item[title="Tüm Tablolar"] {
    display: flex;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 0.75rem;
    padding-top: 1rem;
    padding-bottom: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    box-sizing: border-box;
    flex-shrink: 0;
}

.sidebar-profile {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f39200 0%, #ff6b00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(243, 146, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s;
}

.sidebar-profile:hover {
    transform: scale(1.1);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    background: #f39200;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: #e08500;
    transform: scale(1.05);
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none !important;
    position: fixed;
    top: 40px;
    left: 0;
    width: 100%;
    height: calc(100vh - 40px);
    background: #fff;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    pointer-events: none !important;
    cursor: pointer;
    /* GPU hızlandırma */
    will-change: opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.mobile-overlay.active {
    display: block !important;
    opacity: 1;
    pointer-events: auto !important;
}

/* Desktop'ta overlay kesinlikle görünmez */
@media (min-width: 992px) {
    .mobile-overlay {
        display: none !important;
        pointer-events: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        z-index: -1 !important;
    }
}

/* Body scroll lock when menu is open */
body.menu-open {
    overflow: hidden;
    touch-action: none;
}

/* Form Row Grid */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group-full {
    grid-column: 1 / -1;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Control Section Items Grid */
.control-section-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

/* Sidebar Profile Card - Prototype.html'den alındı */
.sidebar-bottom {
    margin-top: auto !important;
    padding: 0.75rem !important;
    padding-top: 1rem !important;
    padding-bottom: 2rem !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

.sidebar-profile-card {
    display: flex !important;
    align-items: center !important;
    min-height: 64px !important;
    gap: 0.75rem !important;
    padding: 0.75rem !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

.sidebar-profile-card:hover {
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.sidebar-profile-avatar {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, #f39200 0%, #ff6b00 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #fff !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    flex-shrink: 0 !important;
    box-shadow: 0 4px 12px rgba(243, 146, 0, 0.3) !important;
}

.sidebar-profile-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.sidebar-profile-info {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.25rem !important;
}

.sidebar-profile-fullname {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #333 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.sidebar-profile-meta {
    font-size: 0.7rem !important;
    color: #9aa0a9 !important;
    white-space: nowrap !important;
}

/* Sidebar Role Badge - Rozet Box Düzeltmesi */
#sidebarRoleBadge {
    font-size: 0.7rem !important;
    color: #9aa0a9 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.sidebar-profile-action {
    color: #c1c7d0;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
}

