/* 🎨 Modern Design System for Tuva Project */

:root {
    --tuva-primary: #6366f1;
    --tuva-primary-hover: #4f46e5;
    --tuva-secondary: #8b5cf6;
    --tuva-success: #10b981;
    --tuva-danger: #ef4444;
    --tuva-warning: #f59e0b;
    --tuva-info: #06b6d4;
    --tuva-light: #f8fafc;
    --tuva-dark: #0f172a;
    --tuva-card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --tuva-card-shadow-hover: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --tuva-radius: 1.25rem;
    --tuva-radius-sm: 0.75rem;
}

.swal2-container,
.toast-container,
.toast,
#alert-area,
.swal2-popup {
    z-index: 99999999 !important;
}

/* Ensure Modals are layered correctly - High enough to be above sidebars and overlays */
.modal-backdrop {
    z-index: 100001 !important;
}

.modal {
    z-index: 100002 !important;
}

/* 🎨 Unified Light Blue Theme */
body.crm_body_bg,
.main_content,
.footer_part {
    background: #ebf1f5 !important;
    /* Ferah Açık Mavi Tonu */
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Footer Ayarları - Zeminle bütünleşsin */
.footer_part {
    border-top: none !important;
    /* Çizgi kaldırıldı */
    background: transparent !important;
    margin-top: auto;
}

.footer_part p {
    color: #64748b !important;
}

/* Gradient overlay'i sakla/kaldır */
body.crm_body_bg::before {
    display: none !important;
}

.main_content_iner {
    position: relative;
    z-index: 1;
}

/* 🎴 Glassmorphism Cards */
.white_card {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-radius: var(--tuva-radius) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: var(--tuva-card-shadow) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.white_card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.white_card:hover {
    box-shadow: var(--tuva-card-shadow-hover) !important;
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.white_card:hover::before {
    opacity: 1;
}

/* 📊 Premium KPI Cards */
.kpi-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--tuva-radius);
    padding: 2rem;
    color: white;
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.4);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.kpi-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 30px 60px rgba(102, 126, 234, 0.5);
}

.kpi-card h3 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.kpi-card p {
    font-size: 0.95rem;
    opacity: 0.95;
    margin: 0;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* 🎯 Modern Status Icons */
.status-icon {
    width: 56px;
    height: 56px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.status-icon:hover {
    transform: rotate(10deg) scale(1.1);
}

.status-icon.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.status-icon.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.status-icon.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

/* 🏷️ Premium Badges */
.badge-soft {
    padding: 0.5rem 1rem;
    border-radius: var(--tuva-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.badge-soft:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.badge-soft.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-soft.danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* 🔘 Premium Buttons */
.btn {
    border-radius: var(--tuva-radius-sm);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

/* 📱 Responsive Utilities */
@media (max-width: 768px) {
    .kpi-card h3 {
        font-size: 1.5rem;
    }

    .page_title_box {
        flex-direction: column !important;
        gap: 1rem;
    }

    .page_button {
        width: 100%;
    }

    .page_button .btn {
        width: 100%;
        margin-bottom: 0.5rem !important;
    }
}

/* ⏰ Countdown Timer */
#days,
#hours,
#minutes,
#seconds {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--tuva-primary);
    background: linear-gradient(135deg, var(--tuva-primary), var(--tuva-info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 🎭 Smooth Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 🎨 Modern & Framed Header Design (Glassmorphism) */
.header_iner {
    background: rgba(255, 255, 255, 0.4) !important;
    /* Daha şeffaf - Zemin rengini belli etsin */

    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;

    /* Çerçeve ve Kenarlıklar */
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    border-radius: 1rem !important;

    /* Konumlandırma ve Gölge */
    margin: 1rem 1.5rem !important;
    padding: 0.8rem 1.5rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03) !important;
    width: auto !important;
}

.header_iner:hover {
    background: rgba(255, 255, 255, 0.85) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.9) !important;
}

/* Sticky olduğunda tam genişlik */
.header_iner.sticky_menu {
    margin: 0 !important;
    border-radius: 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    background: rgba(255, 255, 255, 0.9) !important;
}

.large_header_bg,
.main_content,
.dashboard_part,
.main_content_iner {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Profil ve icon kutularını sıfırla - Header ile bütünleşsin */
.profile_info,
.switch_toggle {
    background: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
}


.profile_info:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.sidebar_icon {
    background: #fff !important;
    backdrop-filter: blur(10px);
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    /* Removed !important to allow Bootstrap's d-lg-none to work */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    z-index: 10001 !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    padding: 0 !important;
    /* Reset transform jumping */
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.sidebar_icon i {
    font-size: 1.5rem !important;
    color: #1e293b !important;
    /* Deep dark color */
    line-height: 1 !important;
    display: block !important;
    font-weight: 900 !important;
}

.sidebar_icon:hover {
    background: #f8fafc !important;
    transform: translateY(-50%) scale(1.08) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;
}

.switch_toggle {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 0.5rem;
    border-radius: var(--tuva-radius-sm);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 📋 Page Title */
.page_title_box h3 {
    background: linear-gradient(135deg, var(--tuva-primary), var(--tuva-info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

/* 📱 Mobile Menu Styles */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 10000;
        transition: all 0.3s ease;
        width: 280px;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.active {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    body.sidebar-active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }
}

/* 📑 Premium Nav Tabs */
.nav-tabs {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    gap: 0.5rem;
    padding: 1rem 1.5rem 0 1.5rem !important;
}

.nav-tabs .nav-link {
    border: none !important;
    color: #64748b !important;
    font-weight: 600;
    padding: 0.8rem 1.2rem !important;
    border-radius: 0.75rem 0.75rem 0 0 !important;
    transition: all 0.3s ease;
    background: transparent;
    position: relative;
}

.nav-tabs .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    border-radius: 3px 3px 0 0;
}

.nav-tabs .nav-link:hover {
    color: var(--tuva-primary) !important;
    background: rgba(102, 126, 234, 0.05) !important;
}

.nav-tabs .nav-link.active {
    color: var(--tuva-primary) !important;
    background: transparent !important;
}

.nav-tabs .nav-link.active::after {
    width: 80%;
}

/* Form Styling Refinements */
.form-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
    padding: 0.75rem 1rem !important;
    transition: all 0.2s ease !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1) !important;
}

/* 📱 Responsive Additions */
@media (max-width: 991px) {
    .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding: 0.5rem 1rem 0 1rem !important;
    }

    .nav-tabs .nav-link {
        white-space: nowrap !important;
    }
}

/* Author Blocks */
.yazar-blok {
    background: #fff !important;
    border-color: #e2e8f0 !important;
    border-radius: 1rem !important;
    transition: all 0.3s ease;
}

.yazar-blok:hover {
    border-color: var(--tuva-primary) !important;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

/* 🌀 Global Busy Overlay */
.busy-overlay {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(255, 255, 255, 0.85);
    z-index: 100001;
    /* Above almost everything */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.busy-overlay.show {
    display: grid;
}

.busy-overlay .spinner-border {
    width: 3.5rem;
    height: 3.5rem;
    color: var(--tuva-primary) !important;
}

/* 📱 Mobile Specific Z-Index & Overflow Fixes */
@media (max-width: 991px) {

    /* Reduce excessive padding on mobile */
    .main_content_iner {
        padding: 15px !important;
    }

    .header_iner {
        margin: 0.5rem 0.75rem !important;
        padding: 0.5rem 1rem !important;
    }

    /* Fix Sidebar and Body conflicts - Lowered significantly to stay below alerts */
    .sidebar {
        z-index: 10000 !important;
    }

    .sidebar.active,
    .sidebar.active_sidebar {
        left: 0 !important;
    }

    body.sidebar-active::before {
        z-index: 9999 !important;
    }

    .modal-backdrop {
        z-index: 100001 !important;
    }

    .modal {
        z-index: 100002 !important;
    }

    /* Table & Container Overflow Fixes */
    .white_card_body,
    .card-body,
    .container-fluid {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* EXCEPT for table-responsive which SHOULD scroll */
    .table-responsive,
    .tab-content,
    .yazar-blok .row,
    .user-list-container,
    .table-responsive-sm {
        overflow-x: auto !important;
        display: block;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent long words from breaking layout */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p,
    span,
    label,
    td,
    th,
    .fw-bold,
    .text-dark {
        word-break: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }

    /* Fix for horizontal scroll on some forms */
    .row {
        margin-right: -5px !important;
        margin-left: -5px !important;
    }

    .col-12,
    .col-md-12,
    .col-sm-12,
    .col-lg-12 {
        padding-right: 5px !important;
        padding-left: 5px !important;
    }

    /* User Management Card Fixes */
    .user-card .card-body {
        padding: 1rem !important;
    }

    .user-card .ps-4 {
        padding-left: 0.5rem !important;
    }

    .user-status-badges {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        margin-top: 10px;
    }

    .badge-soft {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.7rem !important;
    }

    /* KPI Card responsiveness */
    .kpi-card,
    .kpi-box {
        padding: 1rem !important;
        margin-bottom: 0.75rem !important;
    }

    .kpi-value {
        font-size: 1.25rem !important;
    }
}

/* DataTables and standard tables premium look on mobile */
@media (max-width: 768px) {

    /* Better table display on mobile */
    .table-responsive table {
        min-width: 600px;
        /* Ensure table doesn't squish too much */
    }

    .table thead th {
        padding: 10px 5px !important;
        font-size: 10px !important;
    }

    /* Fix for those buttons in Bildirilerim */
    .btn-group {
        display: inline-flex !important;
        flex-wrap: nowrap !important;
    }

    .btn-action {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
    }
}