:root {
    --color-primary: #6366F1;
    --color-secondary: #818CF8;
    --color-cta: #10B981;
    --color-background: #F8FAFC;
    --color-text: #1E1B4B;
    --color-text-secondary: #64748B;
    --color-border: #E2E8F0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: white;
    border-right: 1px solid var(--color-border);
    padding: 24px 0;
    z-index: 100;
}

.logo {
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 24px;
}

.logo h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
}

.logo p {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    padding: 0 16px;
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 200ms ease;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
}

.nav-link:hover {
    background: #F1F5F9;
    color: var(--color-text);
}

.nav-link.active {
    background: #EEF2FF;
    color: var(--color-primary);
    font-weight: 600;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.main-content {
    margin-left: 260px;
    padding: 24px;
    min-height: 100vh;
}

.header {
    background: white;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #F1F5F9;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.user-badge svg {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 200ms ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--color-cta);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: #EF4444;
    border: 1px solid #FEE2E2;
}

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

.btn svg {
    width: 18px;
    height: 18px;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid #10B981;
}

.toast.error {
    border-left: 4px solid #EF4444;
}

.toast.info {
    border-left: 4px solid #6366F1;
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #10B981;
}

.toast.error .toast-icon {
    color: #EF4444;
}

.toast.info .toast-icon {
    color: #6366F1;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: #1E1B4B;
}

.toast-close {
    background: none;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    width: 20px;
    height: 20px;
}

.toast-close:hover {
    color: #64748B;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 200ms ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.blue {
    background: #EFF6FF;
    color: #3B82F6;
}

.stat-icon.green {
    background: #ECFDF5;
    color: #10B981;
}

.stat-icon.purple {
    background: #F5F3FF;
    color: var(--color-primary);
}

.stat-icon.orange {
    background: #FFF7ED;
    color: #F97316;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    color: var(--color-text);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    transition: all 200ms ease;
}

.form-control:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Hemen Gönder toggle switch — Liste/SMS/Mail panelleri */
.send-now-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #F1F5F9;
    border-radius: 8px;
    margin-bottom: 10px;
}

.send-now-row label {
    font-size: 14px;
    font-weight: 600;
    color: #1E293B;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

.send-now-row .send-now-hint {
    font-size: 12px;
    color: #64748B;
    margin-left: auto;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #CBD5E1;
    transition: background-color 0.2s;
    border-radius: 24px;
}

.switch .slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: transform 0.2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
    background-color: #6366F1;
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

.scheduled-wrap {
    margin-top: 4px;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #F8FAFC;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

tr:hover {
    background: #F8FAFC;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #DCFCE7;
    color: #166534;
}

.badge-pending {
    background: #FEF3C7;
    color: #92400E;
}

.badge-error {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-blue {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-green {
    background: #D1FAE5;
    color: #065F46;
}

.badge-purple {
    background: #EDE9FE;
    color: #6B21A8;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 200ms ease;
}

.btn-sm:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    #mobile-menu-btn {
        display: block !important;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 60px; /* Space for mobile menu button */
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        padding: 16px;
    }
    
    .header h2 {
        font-size: 20px;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .card {
        padding: 16px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    .modal {
        width: 95%;
        padding: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .tag-buttons {
        gap: 6px;
    }
    
    .tag-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    /* List-send specific */
    #panel-list {
        max-height: 400px !important;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 12px;
    }
    
    .header {
        padding: 12px;
    }
    
    .header h2 {
        font-size: 18px;
    }
    
    .card {
        padding: 12px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px;
    }
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 25px rgba(0,0,0,0.15);
    max-width: 500px;
    width: 90%;
}

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

.modal-title {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 200ms ease;
}

.modal-close:hover {
    background: #F1F5F9;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Tag Buttons */
.tag-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-btn {
    padding: 6px 12px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-btn:hover {
    background: var(--color-secondary);
    transform: translateY(-1px);
}

.tag-btn:active {
    transform: translateY(0);
}

.tag-btn.selected {
    background: #4F46E5 !important;
    color: white !important;
    border: 2px solid #4338CA !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3) !important;
    font-weight: 600 !important;
    padding: 5px 11px !important;
}

.tag-btn.selected::before {
    content: "✓ ";
    font-weight: 700;
}

/* Badge Styles */
.badge-red {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-yellow {
    background: #FEF3C7;
    color: #92400E;
}

/* ============================================================
   UI Improvements Layer (additive, no conflict with existing)
   ============================================================ */

:root {
    /* Spacing scale (4-unit base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --space-9: 48px;

    /* Type scale */
    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-base: 14px;
    --fs-md: 15px;
    --fs-lg: 16px;
    --fs-xl: 18px;
    --fs-2xl: 20px;
    --fs-3xl: 24px;

    /* Radii */
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 16px;
}

/* --- Typography helpers --- */
.text-muted { color: var(--color-text-secondary); }
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-lg { font-size: var(--fs-lg); }
.text-bold { font-weight: 600; }
.text-semibold { font-weight: 500; }

.mono {
    font-family: 'Courier New', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* --- Spacing rhythm helpers --- */
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-md > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

.cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
}

/* --- Panel section heading (replaces inline h4 styles for 📋 Liste Paneli etc.) --- */
.panel-title {
    font-family: 'Poppins', sans-serif;
    font-size: var(--fs-xl);
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 var(--space-4) 0;
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* --- Alert / info banners (replaces inline red/yellow/blue boxes) --- */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
    line-height: 1.5;
    margin: var(--space-3) 0;
    border: 1px solid transparent;
}

.alert-info {
    background: #DBEAFE;
    border-color: #93C5FD;
    color: #1E40AF;
}

.alert-success {
    background: #DCFCE7;
    border-color: #86EFAC;
    color: #166534;
}

.alert-warning {
    background: #FEF3C7;
    border-color: #FCD34D;
    color: #92400E;
}

.alert-error {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #991B1B;
}

.alert strong { font-weight: 700; }
.alert small { display: block; margin-top: 4px; opacity: 0.85; font-size: var(--fs-xs); }

/* --- Empty state --- */
.empty-state {
    padding: var(--space-8) var(--space-6);
    text-align: center;
    color: var(--color-text-secondary);
    background: #F8FAFC;
    border: 1px dashed #CBD5E1;
    border-radius: var(--r-lg);
}

.empty-state-icon {
    font-size: 36px;
    margin-bottom: var(--space-3);
    display: block;
    opacity: 0.6;
}

.empty-state-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: var(--fs-base);
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.empty-state-text {
    font-size: var(--fs-sm);
    color: var(--color-text-secondary);
}

/* --- Loading state (skeleton) --- */
.skeleton {
    background: linear-gradient(90deg, #F1F5F9 0%, #E2E8F0 50%, #F1F5F9 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: var(--r-sm);
    height: 16px;
}

.skeleton-lg { height: 24px; }
.skeleton-sm { height: 12px; }

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-state {
    padding: var(--space-5);
    text-align: center;
    color: var(--color-text-secondary);
    font-size: var(--fs-sm);
}

.loading-state::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: var(--space-2);
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Stat card polish (top accent line, optional) --- */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-cta));
    opacity: 0;
    transition: opacity 200ms ease;
}

.stat-card:hover::before { opacity: 1; }

/* --- Card title with icon support --- */
.card-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* --- Keyboard focus ring (accessibility) --- */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

button:focus-visible,
.btn:focus-visible {
    outline-offset: 3px;
}

/* --- Smoother scrollbars (webkit) --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #F8FAFC; }
::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 5px;
    border: 2px solid #F8FAFC;
}
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
