/* Common Styles for Sendione */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Mobile: Break flex layout */
@media screen and (max-width: 768px) {
    body {
        display: block !important;
        height: auto !important;
        min-height: 100vh !important;
        overflow-x: hidden !important;
        position: relative !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    /* Tüm container'ları sınırla - Sidebar hariç */
    *:not(.sidebar):not(.sidebar *) {
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    
    /* Sidebar için özel - max-width kısıtlaması yok */
    .sidebar,
    .sidebar * {
        max-width: none !important;
        box-sizing: border-box !important;
    }
    
    html {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    position: relative; /* Desktop'ta relative */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    height: 100vh;
    overflow: hidden; /* scroll'u nav-menu'ye ver */
}

/* Desktop'ta sidebar normal görünümde */
@media screen and (min-width: 769px) {
    .sidebar {
        position: relative !important;
        left: auto !important;
    }
}

/* Mobile: Hide sidebar by default - STRONG RULES */
@media screen and (max-width: 768px) {
    /* Body flex layout'u kır */
    body {
        display: block !important;
        height: auto !important;
        min-height: 100vh !important;
        overflow-x: hidden !important;
        position: relative !important;
    }
    
    .sidebar {
        position: fixed !important;
        left: -260px !important;
        top: 0 !important;
        bottom: 0 !important;
        z-index: 10000 !important;
        height: 100vh !important;
        width: 260px !important;
        max-width: 260px !important;
        min-width: 260px !important;
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: flex !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        /* Desktop görünümünü kapat */
        flex-shrink: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    
    .sidebar:not(.open) {
        left: -260px !important;
        transform: translateX(0) !important;
    }
    
    /* Daha spesifik selector - inline style'ı override eder */
    .sidebar.open[style*="left"] {
        left: 0 !important;
    }
    
    .sidebar.open {
        left: 0 !important;
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: flex !important;
    }
    
    /* Main content'i sidebar'ın altına itme - SABİT GENİŞLİK */
    .main-content {
        width: 100% !important;
        max-width: 100vw !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        flex: none !important;
        min-height: 100vh !important;
        position: relative !important;
        z-index: 1 !important;
        box-sizing: border-box !important;
    }
    
    /* Sidebar açıkken de main-content genişliği değişmemeli */
    .sidebar.open ~ .main-content,
    body:has(.sidebar.open) .main-content {
        width: 100% !important;
        max-width: 100vw !important;
        margin-left: 0 !important;
    }
    
    /* Header'ı sidebar'ın altında tut ama hamburger butonu üstte */
    .header {
        position: relative !important;
        z-index: 1000 !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    
    /* Hamburger butonu header'ın üstünde olmalı */
    .header .mobile-menu-toggle {
        z-index: 10002 !important;
        position: relative !important;
    }
    
    /* Content area'yı sidebar'ın altında tut */
    .content {
        position: relative !important;
        z-index: 1 !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
}

.logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: #1e3a8a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: white;
}

.nav-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-item {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    margin: 2px 12px;
    border-radius: 10px;
    position: relative;
    background: rgba(255, 255, 255, 0.03);
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
    border-radius: 0 3px 3px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-item:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
    color: white;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-item:hover::before {
    opacity: 1;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.12) 100%);
    color: white;
    border-left: 4px solid #60a5fa;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.nav-item.active::before {
    opacity: 1;
    width: 4px;
    background: linear-gradient(180deg, #93c5fd 0%, #60a5fa 100%);
}

.nav-item i { 
    font-size: 18px; 
    width: 20px;
    font-style: normal;
    font-weight: normal;
}

.nav-badge {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-sub-item {
    font-size: 14px;
    padding: 10px 20px 10px 48px !important;
    margin: 2px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s ease;
}

.nav-sub-item:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.06) 100%);
    color: white;
    transform: translateX(2px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-footer {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Mobile: Full width */
@media screen and (max-width: 768px) {
    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
        flex: none !important;
        min-height: 100vh !important;
    }
}

.header {
    background: white;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 1000;
    position: relative;
}

/* Mobile: Adjust header */
@media screen and (max-width: 768px) {
    .header {
        padding: 12px 16px !important;
        flex-wrap: nowrap;
        gap: 12px;
        background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    }
    
    .header h2 {
        font-size: 18px !important;
        margin: 0 !important;
        flex: 1;
        color: #1e293b;
        font-weight: 600;
    }
    
    .header-right {
        display: flex;
        align-items: center;
        gap: 8px;
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.user-name {
    font-weight: 500;
    color: #1e293b;
}

/* Content Area */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

/* Mobile: Adjust content */
@media screen and (max-width: 768px) {
    .content {
        padding: 16px !important;
        overflow-x: hidden !important;
    }
}

/* Cards */
.card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 24px;
    border: 1px solid rgba(37, 99, 235, 0.1);
}

/* Mobile: Better card design */
@media screen and (max-width: 768px) {
    .card {
        padding: 16px !important;
        margin-bottom: 16px;
        box-shadow: 0 2px 12px rgba(37, 99, 235, 0.12) !important;
        border: 2px solid rgba(37, 99, 235, 0.15) !important;
    }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-success {
    background: #22c55e;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: #64748b;
}

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

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 12px 0;
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 2px solid #f1f5f9;
}

.table td {
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

.table tr:hover {
    background: #f8fafc;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1e293b;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Messages */
.message {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 0;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 20px;
    font-weight: 600;
}

.modal-header .close {
    font-size: 28px;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-header .close:hover {
    color: #1e293b;
}

.modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.modal-actions {
    padding: 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 10px 14px;
    margin-right: 12px;
    z-index: 10001 !important;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto !important;
}

.mobile-menu-toggle:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Force show on mobile - test */
@media screen and (max-width: 768px) {
    .mobile-menu-toggle {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: all !important;
        cursor: pointer !important;
        z-index: 10001 !important;
        position: relative !important;
        background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%) !important;
        border: none !important;
        color: white !important;
        font-size: 24px !important;
        padding: 10px 14px !important;
        margin-right: 12px !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3) !important;
        min-width: 44px !important;
        min-height: 44px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.3) !important;
    }
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    /* Mobile Menu Toggle - Force visible */
    .mobile-menu-toggle {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: all !important;
        cursor: pointer !important;
        z-index: 10001 !important;
        position: relative !important;
    }
    
    /* Sidebar Overlay - sidebar'ın altında ama content'in üstünde */
    .sidebar-overlay {
        display: block !important;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 9999 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.6) !important;
        visibility: hidden;
        width: 100vw !important;
        height: 100vh !important;
    }
    
    .sidebar-overlay.active {
        opacity: 1 !important;
        pointer-events: all !important;
        z-index: 9999 !important;
        visibility: visible !important;
        display: block !important;
    }
    
    /* Header - Adjust padding */
    .header {
        padding: 12px 16px;
    }
    
    .header h2 {
        font-size: 18px;
    }
    
    /* Hide user name on mobile, show only avatar */
    .user-name {
        display: none;
    }
    
    /* Content - Reduce padding */
    .content {
        padding: 16px;
    }
    
    /* Cards - Adjust padding */
    .card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    /* Tables - Make scrollable */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Tablo wrapper - tüm tablolar için */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    /* Tüm tabloları otomatik olarak scrollable yap - Daha güçlü kurallar */
    table,
    .table,
    .campaign-table {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        display: table !important;
    }
    
    /* Tablo wrapper olmadan da çalışsın */
    .content table,
    .content .table,
    .content .campaign-table {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
    }
    
    /* Tüm div'lerde overflow kontrolü */
    .content,
    .main-content,
    .card,
    .campaigns-section,
    .stats-section,
    .performance-section {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    /* Tablo container'ları için özel */
    #recentCampaigns,
    #campaignsList,
    .table-container,
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    /* Tablo hücrelerini daha kompakt yap */
    .table th,
    .table td {
        padding: 8px 4px !important;
        font-size: 12px !important;
        white-space: nowrap;
    }
    
    /* Campaign table için özel */
    .campaign-table {
        min-width: 100% !important;
    }
    
    .campaign-table th,
    .campaign-table td {
        padding: 12px 8px !important;
        font-size: 13px !important;
    }
    
    /* Forms - Stack on mobile */
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    /* Modal - Full width on mobile */
    .modal-content {
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
        border-radius: 0 !important;
        max-height: 100vh !important;
        height: 100vh !important;
    }
    
    /* Kampanya oluşturma modal'ı için */
    #createModal .modal-content {
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 16px !important;
        max-height: 100vh !important;
        height: 100vh !important;
        border-radius: 0 !important;
    }
    
    #createModal .form-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .modal-header,
    .modal-body,
    .modal-actions {
        padding: 16px;
    }
    
    /* Buttons - Full width on mobile */
    .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
    
    /* Touch target boyutları - tüm tıklanabilir elementler için */
    button,
    .btn,
    a.btn,
    .nav-item,
    .mobile-menu a {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 12px 16px !important;
    }
    
    /* Input ve select için de yeterli padding */
    input,
    select,
    textarea {
        min-height: 44px !important;
        padding: 12px 16px !important;
        font-size: 16px !important; /* iOS zoom önleme */
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 44px !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 10px 12px;
    }
    
    .header h2 {
        font-size: 16px;
    }
    
    .content {
        padding: 12px !important;
    }
    
    .card {
        padding: 12px !important;
        margin-bottom: 12px !important;
    }
    
    /* Butonlar tam genişlik */
    .btn {
        width: 100% !important;
        margin-bottom: 12px !important;
    }
    
    .logo-text {
        font-size: 16px;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    /* Tablo hücreleri daha da küçük */
    .table th,
    .table td {
        padding: 6px 2px !important;
        font-size: 11px !important;
    }
    
    .campaign-table th,
    .campaign-table td {
        padding: 10px 6px !important;
        font-size: 12px !important;
    }
}

/* iOS ve Android için viewport düzeltmeleri */
@supports (-webkit-touch-callout: none) {
    /* iOS özel düzeltmeler */
    body {
        -webkit-font-smoothing: antialiased;
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
    }
}

/* Mobile responsive updates - Wed Jan 14 10:28:30 +03 2026 */
/* Mobile fix - 2026-01-14 10:47:00 */
/* Comprehensive mobile fixes - 2026-01-14 */
