/* Nav menu positioning for full-width mega menus */
.nav-menu {
    position: relative;
}

/* Nav item positioning for mega menu */
.nav-item {
    position: relative;
}

/* Mega menu container */
.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 700px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1001;
    padding: 0;
    overflow: visible;
    pointer-events: none;
}

/* Show mega menu on hover */
.nav-item:hover .mega-menu,
.nav-item.active .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Mega menu grid layout */
.mega-menu-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    /* Items flow from top to bottom, then to next column */
    grid-auto-flow: column;
    /* Default 3 rows for 6 items (most menus have 6 items) */
    grid-template-rows: repeat(3, auto);
    border: 1px solid #e4e8f0;
    border-top: none;
    /* Sol üst köşe 0 - başlıkla bütünleşmesi için */
    border-radius: 0 12px 12px 12px;
    padding: 0;
    gap: 0;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(12, 38, 97, 0.12);
    position: relative;
    z-index: 1002;
    /* Ensure seamless connection with nav item */
    margin-top: 0;
}

.mega-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    min-height: 40px;
    color: #15345a;
    text-decoration: none;
    background: #ffffff;
    border-radius: 0;
    border-right: 1px solid #e4e8f0;
    border-bottom: 1px solid #e4e8f0;
    transition: color 0.2s ease;
    position: relative;
}

/* Default: Remove right border on second column (items 4+) */
.mega-menu-item:nth-child(n+4) {
    border-right: none;
}

/* Default: Remove bottom border on row ends (every 3rd item) */
.mega-menu-item:nth-child(3n) {
    border-bottom: none;
}

/* SSL Hosting menu - 3 items, 1 column (3 items stacked vertically) */
.mega-menu.ssl-mega .mega-menu-content {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, auto);
    max-width: 300px;
}

/* All SSL items - no right border (single column) */
.mega-menu.ssl-mega .mega-menu-item {
    border-right: none;
}

/* First and second items have bottom border */
.mega-menu.ssl-mega .mega-menu-item:nth-child(1),
.mega-menu.ssl-mega .mega-menu-item:nth-child(2) {
    border-bottom: 1px solid #e4e8f0;
}

/* Last item has no bottom border */
.mega-menu.ssl-mega .mega-menu-item:nth-child(3) {
    border-bottom: none;
}

/* SMS menu - 4 items, 2 columns x 2 rows */
.mega-menu.sms-mega .mega-menu-content {
    grid-template-rows: repeat(2, 1fr);
}

.mega-menu.sms-mega .mega-menu-item:nth-child(n+3) {
    border-right: none;
}

/* Only bottom row items (2nd and 4th) have no bottom border */
.mega-menu.sms-mega .mega-menu-item:nth-child(2),
.mega-menu.sms-mega .mega-menu-item:nth-child(4) {
    border-bottom: none;
}

/* Top row items (1st and 3rd) have bottom border */
.mega-menu.sms-mega .mega-menu-item:nth-child(1),
.mega-menu.sms-mega .mega-menu-item:nth-child(3) {
    border-bottom: 1px solid #e4e8f0;
}

.mega-menu-item:hover {
    text-decoration: none;
}

.mega-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: transparent;
    color: #0f3f8c;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.mega-menu-item:hover .mega-menu-icon {
    transform: translateY(-3px);
    color: #05c0c6;
    box-shadow: none;
}

.mega-menu-icon i {
    color: inherit;
    transition: color 0.2s ease;
}

.mega-menu-item:hover .mega-menu-icon i {
    color: #05c0c6;
}

.mega-menu-item:hover .mega-menu-title {
    color: #05c0c6;
}

.mega-menu-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mega-menu-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mega-menu-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f3f8c;
    line-height: 1.25;
    margin: 0;
}

.mega-menu-desc {
    font-size: 12px;
    color: #6d7b8c;
    line-height: 1.4;
    margin: 0;
}

.mega-menu-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    background: linear-gradient(135deg, #00c4b3 0%, #00d6c2 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    box-shadow: 0 6px 14px rgba(0, 198, 179, 0.22);
    letter-spacing: 0.08px;
}

/* Active and hover states for nav items */
.nav-item.active > a,
.nav-item:hover > a {
    color: #0f3f8c;
}

/* Wide mega menu layout for Sunucular (like corporate) - Requirements: 3.14, 3.15 */
.mega-menu.server-mega {
    /* Same positioning as corporate - centered relative to viewport */
    left: calc(-47vw + 100%);
    right: auto;
    transform: none;
    width: 80vw;
    min-width: 80vw;
}

.mega-menu.server-mega .mega-menu-content,
.mega-menu.server-mega .mega-menu-content.server-grid {
    display: grid !important;
    /* 4 equal width columns for server sections */
    grid-template-columns: repeat(4, minmax(200px, 1fr)) !important;
    grid-template-rows: auto !important;
    grid-auto-flow: row !important;
    gap: 0;
    border-radius: 14px;
    border: 1px solid #e4e8f0;
    box-shadow: 0 16px 34px rgba(8, 32, 94, 0.18);
    overflow: hidden;
    align-items: stretch;
}

/* SMS mega menu - shifted left */
.mega-menu.sms-mega {
    left: calc(-280px);
    right: auto;
    transform: none;
}

/* Yazılım (Software) mega menu - shifted left */
.mega-menu.software-mega {
    left: calc(-350px);
    right: auto;
    transform: none;
}

/* Corporate mega menu layout */
.corporate-mega {
    left: calc(-52vw + 100%);
    right: auto;
    transform: none;
    width: 68vw;
    min-width: 68vw;
    max-width: 1150px;
}

.corporate-mega .mega-menu-content,
.corporate-mega .mega-menu-content.corporate-grid {
    display: grid !important;
    /* 4 sütun: 3 eşit genişlikte içerik sütunu + 1 iletişim sütunu */
    grid-template-columns: repeat(3, minmax(170px, 1fr)) 260px !important;
    grid-template-rows: auto !important;
    grid-auto-flow: row !important;
    gap: 0;
    border-radius: 12px;
    border: 1px solid #e4e8f0;
    box-shadow: 0 16px 34px rgba(8, 32, 94, 0.18);
    overflow: hidden;
    align-items: stretch;
}

.corporate-col {
    padding: 10px 12px;
    background: #fff;
    border-right: 1px solid #e8edf5;
    min-height: 100%;
}

.corporate-col:last-of-type {
    border-right: none;
}

.corporate-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #0a3f92;
    margin-bottom: 10px;
    position: relative;
}

.corporate-heading .heading-underline {
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 56px;
    height: 3px;
    background: #05c0c6;
    border-radius: 4px;
}

.corporate-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
}

.corporate-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    color: #143d7b;
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
    border-bottom: 1px solid #e9eef5;
    transition: color 0.2s ease;
}

.corporate-link:last-child {
    border-bottom: none;
}

.corporate-link i {
    font-size: 12px;
    color: #0a3f92;
    transition: transform 0.2s ease, color 0.2s ease;
}

.corporate-link:hover {
    color: #05c0c6;
    text-decoration: none;
}

.corporate-link:hover i {
    transform: translateX(3px);
    color: #05c0c6;
}

.corporate-contact {
    background: linear-gradient(135deg, #0b2f6d 0%, #0a2a66 100%);
    color: #ffffff;
    padding: 16px 14px;
    display: grid;
    gap: 16px;
    min-height: 100%;
    align-content: center;
    border-radius: 0 12px 12px 0;
    margin: 0;
}

.corporate-contact .contact-row + .contact-row {
    margin-top: 6px;
}

.contact-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.contact-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #05c0c6;
    font-size: 18px;
}

.contact-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.contact-label {
    font-size: 13px;
    opacity: 0.82;
}

.contact-value {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

/* Mega Menu Overlay - Requirements: 8.1, 8.2, 8.3, 8.4, 8.5 */
.mega-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(10, 30, 80, 0.55);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

/* Show overlay when active class is added */
.mega-menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

/* Header should NOT have z-index so children can escape stacking context */
.header {
    position: relative;
    z-index: auto;
}

.main-header {
    position: relative;
    z-index: auto;
}

.top-bar {
    position: relative;
    z-index: auto;
}

/* Responsive adjustments */
@media (max-width: 1320px) {
    .mega-menu {
        min-width: 100%;
        left: 0;
        right: 0;
    }
}

@media (max-width: 1320px) {
    .mega-menu {
        display: none;
    }
    
    .mega-menu-content {
        grid-template-columns: 1fr;
    }
    
    .mega-menu-item {
        border-right: none;
        border-bottom: 1px solid #e3ebf7;
    }
    
    .mega-menu-item:last-child {
        border-bottom: none;
    }
}
