/* ============================================================
   SX64 Common CSS v2.4.0
   Ortak stiller, responsive, mobil uyumluluk
   ============================================================ */

/* === RESET & BASE === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary-color: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-light: rgba(59,130,246,0.1);
    --bg-body: linear-gradient(135deg, rgba(241,245,249,0.95) 0%, rgba(226,232,240,0.95) 100%);
    --bg-card: rgba(255,255,255,0.85);
    --bg-card-hover: rgba(255,255,255,0.95);
    --border-color: rgba(148,163,184,0.2);
    --border-color-hover: rgba(148,163,184,0.4);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.15);
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --transition: all 0.2s ease;
}

body {
    font-family: var(--font-family);
    background: var(--bg-body);
    min-height: 100vh;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

/* === LAYOUT === */
.container { max-width: 500px; width: 100%; margin: 0 auto; padding: 20px; }
.container-wide { max-width: 960px; width: 100%; margin: 0 auto; padding: 20px; }
.container-full { max-width: 1200px; width: 100%; margin: 0 auto; padding: 20px; }

/* === CARD === */
.card, .form-card, .page-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

/* === PAGE HEADER === */
.page-header, .hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.page-header h1, .hdr h1 { font-size: 22px; font-weight: 600; color: var(--text-primary); }
.page-header h1 span, .hdr h1 span { color: var(--primary-color); }

/* === FORM === */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; font-weight: 500; }

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(148,163,184,0.3);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--text-primary);
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
    background: #fff;
}
.form-control option { background: #fff; color: var(--text-primary); }

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

.help-text { font-size: 11px; color: var(--text-light); margin-top: 6px; }

.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group label { margin-bottom: 0; }

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-family);
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(59,130,246,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59,130,246,0.4); }

.btn-secondary {
    background: rgba(100,116,139,0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: rgba(100,116,139,0.15); }

.btn-danger { background: rgba(239,68,68,0.1); color: #dc2626; }
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-success { background: rgba(34,197,94,0.1); color: #16a34a; }
.btn-success:hover { background: rgba(34,197,94,0.2); }

.btn-full { width: 100%; }

.btn-wrapper { margin-top: 24px; }

.btn-add {
    width: 40px; height: 40px;
    border-radius: 12px; border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff; font-size: 22px; cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
    display: flex; align-items: center; justify-content: center;
}
.btn-add:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(59,130,246,0.4); }

/* === TABLE === */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; }
.table th {
    background: rgba(241,245,249,0.8);
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.table td {
    padding: 12px 16px;
    font-size: 14px;
    color: #334155;
    border-bottom: 1px solid rgba(148,163,184,0.1);
    vertical-align: middle;
}
.table tr:hover td { background: rgba(241,245,249,0.5); }

/* === TABLE ACTION BUTTONS === */
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

.btn-sm {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.btn-edit { background: rgba(59,130,246,0.1); color: #2563eb; }
.btn-edit:hover { background: rgba(59,130,246,0.2); }
.btn-toggle { background: rgba(245,158,11,0.1); color: #d97706; }
.btn-toggle:hover { background: rgba(245,158,11,0.2); }
.btn-delete { background: rgba(239,68,68,0.1); color: #dc2626; }
.btn-delete:hover { background: rgba(239,68,68,0.2); }

/* === STATUS BADGE === */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}
.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.s-aktif { color: #16a34a; }
.s-aktif .status-dot { background: #22c55e; }
.s-pasif { color: #dc2626; }
.s-pasif .status-dot { background: #ef4444; }

/* === POPUP / DIALOG === */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.dialog {
    width: 100%;
    max-width: 400px;
    background: linear-gradient(135deg, #fff, #f8fafc);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.dlg-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.dlg-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }

.dlg-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(239,68,68,0.1);
    color: #ef4444;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.dlg-close:hover { background: rgba(239,68,68,0.2); }

.msg-wrap { display: flex; gap: 16px; align-items: flex-start; }

.msg-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.msg-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

.msg-txt h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.msg-txt p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.dlg-btn {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.dlg-btn button, .dlg-btn .btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

/* === LOADING SPINNER === */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: var(--text-light);
    font-size: 14px;
}
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(148,163,184,0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* === ICON PREVIEW === */
.icon-preview {
    width: 36px; height: 36px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}
.icon-preview svg { width: 16px; height: 16px; }

/* === SVG ICONS (inline) === */
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.5); }

/* ============================================================
   RESPONSIVE - MOBILE FIRST
   ============================================================ */

/* Tablet */
@media (max-width: 768px) {
    .container { padding: 12px; max-width: 100%; }
    .container-wide { padding: 12px; max-width: 100%; }
    .container-full { padding: 12px; max-width: 100%; }

    .card, .form-card, .page-card {
        border-radius: 14px;
        padding: 20px;
    }

    .page-header h1, .hdr h1 { font-size: 18px; }

    .table th { padding: 10px 12px; font-size: 12px; }
    .table td { padding: 10px 12px; font-size: 13px; }

    .action-btns { flex-direction: column; }
    .btn-sm { width: 100%; text-align: center; padding: 8px 12px; }

    .dialog { max-width: 95%; padding: 20px; margin: 10px; }
}

/* Mobile */
@media (max-width: 480px) {
    body { font-size: 14px; }

    .container, .container-wide, .container-full { padding: 8px; }

    .card, .form-card, .page-card {
        border-radius: 12px;
        padding: 16px;
    }

    .page-header, .hdr {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .page-header h1, .hdr h1 { font-size: 17px; }

    .form-control { padding: 11px 12px; font-size: 16px; /* prevents zoom on iOS */ }

    .btn { padding: 12px 20px; font-size: 14px; }
    .btn-primary { width: 100%; }

    .table-container { margin: 0 -16px; padding: 0 16px; }
    .table th, .table td { padding: 8px 10px; font-size: 12px; }
    .table th:first-child, .table td:first-child { padding-left: 12px; }

    .dialog { max-width: 100%; margin: 8px; padding: 16px; border-radius: 14px; }

    .overlay { padding: 8px; }

    /* Uzun metinleri tablo icinde kes */
    .table td { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ============================================================
   TOUCH FRIENDLY
   ============================================================ */
@media (pointer: coarse) {
    .btn, .btn-sm, .btn-add, .dlg-close, .form-control { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .table td, .table th { padding: 14px 12px; }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    body { background: #fff !important; }
    .card, .form-card, .page-card { box-shadow: none; border: 1px solid #ddd; }
    .btn, .action-btns, .overlay, .dialog { display: none !important; }
}
