@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4F46E5;
    --primary-hover: #4338ca;
    --bg: #F3F4F6;
    --surface: #FFFFFF;
    --text: #1F2937;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --danger: #EF4444;
    --success: #10B981;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 0.25rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem 4px;
    overflow-x: hidden;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 12px;
}

h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text);
    position: relative;
    display: inline-block;
    text-transform: uppercase;
}

h1::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 96vw;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 2px;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: #F9FAFB;
    border-color: var(--text-secondary);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #DC2626;
}

/* Yazdır Butonu - Mavi */
.btn-print {
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    color: white;
    border: none;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-print:hover {
    background: linear-gradient(135deg, #2563EB, #1E40AF);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-print:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
}

/* Yeni Kayıt Butonu - Yeşil */
.btn-add {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    border: none;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.btn-add:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-add:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(16, 185, 129, 0.3);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

/* Minimal Table Styles */
th,
td {
    padding: 0.75rem 1rem;
    border: none;
}

th {
    background-color: #E5E7EB;
    font-weight: 700;
    color: #111827;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #D1D5DB;
    text-align: center;
}

td {
    font-size: 0.8rem;
    color: var(--text);
    vertical-align: middle;
}

/* Center S.No Column */
th:first-child,
td:first-child {
    text-align: center;
}

tr {
    border-bottom: 1px solid #F3F4F6;
    transition: background-color 0.2s;
}

/* Zebra Striping (Rows) */
tr:nth-child(even) {
    background-color: #F9FAFB;
}

/* Zebra Striping (Columns) */
td:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

tr:last-child {
    border-bottom: none;
}

tr:hover {
    background-color: #F3F4F6;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

/* Badges (Sweet Containers) */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
}

.badge-kurum {
    background-color: #EEF2FF;
    color: #4F46E5;
    border: 1px solid #C7D2FE;
}

.badge-ilce {
    background-color: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
}

.badge-ilce-merkez {
    background-color: #E0F2FE;
    color: #0369A1;
    border-color: #BAE6FD;
}

.badge-ilce-kelkit {
    background-color: #FEF3C7;
    color: #B45309;
    border-color: #FDE68A;
}

.badge-ilce-siran {
    background-color: #F3E8FF;
    color: #6B21A8;
    border-color: #E9D5FF;
}

.badge-ilce-torul {
    background-color: #DCFCE7;
    color: #15803D;
    border-color: #BBF7D0;
}

.badge-ilce-kurtun {
    background-color: #FFE4E6;
    color: #C2410C;
    border-color: #FECDD3;
}

.badge-ilce-kose {
    background-color: #FFF1F2;
    color: #9F1239;
    border-color: #FFE4E6;
}

.badge-adres {
    background-color: #F3F4F6;
    color: #4B5563;
    border: 1px solid #E5E7EB;
    white-space: normal;
}

.badge-baskan {
    background-color: #FFF7ED;
    color: #EA580C;
    border: 1px solid #FED7AA;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal.open .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input,
textarea,
select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Search Bar */
.search-bar {
    margin-bottom: 1rem;
    position: relative;
}

.search-bar input {
    padding-left: 2.5rem;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Flash Message */
.flash-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 2000;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid transparent;
}

.flash-message.show {
    transform: translateX(0);
}

.flash-message.success {
    border-left-color: var(--success);
}

.flash-message.error {
    border-left-color: var(--danger);
}

.flash-icon {
    font-size: 1.25rem;
}

.flash-message.success .flash-icon {
    color: var(--success);
}

.flash-message.error .flash-icon {
    color: var(--danger);
}

.flash-text {
    font-weight: 500;
    color: var(--text);
    font-size: 0.875rem;
}

/* Drag & Drop Sorting Styles */
.drag-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    opacity: 0;
    transition: all 0.2s ease;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.1), transparent);
    border-radius: 4px 0 0 4px;
}

.drag-handle::before {
    content: '⋮⋮';
    font-size: 12px;
    color: var(--primary);
    letter-spacing: -2px;
    font-weight: 700;
}

tr {
    position: relative;
}

tr:hover .drag-handle {
    opacity: 1;
}

.drag-handle:hover {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.2), transparent);
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Sürüklenen satır */
tr.dragging {
    background: rgba(79, 70, 229, 0.1) !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    opacity: 0.9;
    z-index: 100;
}

tr.dragging .drag-handle {
    opacity: 1;
    background: rgba(79, 70, 229, 0.3);
    cursor: grabbing;
}

/* Bırakma noktası göstergesi */
tr.drag-over {
    border-top: 3px solid var(--primary) !important;
}

tr.drag-over::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -2px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* İlk sütun için padding ayarı (drag handle için yer bırak) */
td:first-child {
    position: relative;
    padding-left: 32px !important;
}

/* Sıralama modu aktifken tablo stili */
.table-container.sorting-active table tbody tr {
    transition: transform 0.2s ease, background-color 0.2s ease;
}

/* Sıralama bilgi mesajı */
.sorting-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sorting-hint.show {
    opacity: 1;
}

/* ==================== DASHBOARD KARTLARI ==================== */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 0 12px;
}

.dashboard-card {
    background: var(--surface);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    padding: 0;
    min-height: 160px;
    display: flex;
    flex-direction: column;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.2);
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    z-index: 20;
    border-radius: 1rem 1rem 0 0;
}

.card-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.dashboard-card:hover .card-bg-image {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.8));
    transition: background 0.3s ease;
}

.dashboard-card:hover .card-overlay {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.9));
}

.card-content {
    position: relative;
    z-index: 10;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

/* Kart renkleri (Üst Çizgi) */
.dashboard-card.card-total::before {
    background: linear-gradient(90deg, #4F46E5, #7C3AED);
}

.dashboard-card.card-merkez::before {
    background: linear-gradient(90deg, #0369A1, #0EA5E9);
}

.dashboard-card.card-kelkit::before {
    background: linear-gradient(90deg, #B45309, #F59E0B);
}

.dashboard-card.card-siran::before {
    background: linear-gradient(90deg, #6B21A8, #A855F7);
}

.dashboard-card.card-torul::before {
    background: linear-gradient(90deg, #15803D, #22C55E);
}

.dashboard-card.card-kurtun::before {
    background: linear-gradient(90deg, #C2410C, #F97316);
}

.dashboard-card.card-kose::before {
    background: linear-gradient(90deg, #9F1239, #F43F5E);
}

/* Fallback colors for images */
.card-total .card-bg-image {
    background-color: #4F46E5;
}

.card-merkez .card-bg-image {
    background-color: #0369A1;
}

.card-kelkit .card-bg-image {
    background-color: #B45309;
}

.card-siran .card-bg-image {
    background-color: #6B21A8;
}

.card-torul .card-bg-image {
    background-color: #15803D;
}

.card-kurtun .card-bg-image {
    background-color: #C2410C;
}

.card-kose .card-bg-image {
    background-color: #9F1239;
}

.dashboard-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.dashboard-card-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.dashboard-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card-total .dashboard-card-icon {
    background: rgba(79, 70, 229, 0.85);
    color: white;
}

.card-merkez .dashboard-card-icon {
    background: rgba(3, 105, 161, 0.85);
    color: white;
}

.card-kelkit .dashboard-card-icon {
    background: rgba(180, 83, 9, 0.85);
    color: white;
}

.card-siran .dashboard-card-icon {
    background: rgba(107, 33, 168, 0.85);
    color: white;
}

.card-torul .dashboard-card-icon {
    background: rgba(21, 128, 61, 0.85);
    color: white;
}

.card-kurtun .dashboard-card-icon {
    background: rgba(194, 65, 12, 0.85);
    color: white;
}

.card-kose .dashboard-card-icon {
    background: rgba(159, 18, 57, 0.85);
    color: white;
}

.dashboard-card-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.dashboard-card-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

/* Yazdırmada dashboard'u gizle */
@media print {
    .dashboard {
        display: none !important;
    }
}