:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-light: #64748b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.section {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Modern Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.75rem 1.25rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.stat-card.success::before {
    background: #22c55e;
}

.stat-card.warning::before {
    background: #f59e0b;
}

.stat-card.error::before {
    background: #ef4444;
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-card.success .stat-value {
    color: #16a34a;
}

.stat-card.warning .stat-value {
    color: #d97706;
}

.stat-card.error .stat-value {
    color: #dc2626;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.stat-status.ok {
    background: #dcfce7;
    color: #166534;
}

.stat-status.error {
    background: #fee2e2;
    color: #991b1b;
}

/* Dashboard Section Styling */
.dashboard-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    border: 1px solid var(--border);
}

.dashboard-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 0.4rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-light);
    cursor: pointer;
    user-select: none;
}

.data-table th:hover {
    background: #e8e8e8;
}

.data-table th .sort-indicator {
    margin-left: 0.25rem;
    font-size: 0.7rem;
}

/* PROJE KODU */
.data-table th:nth-child(1),
.data-table td:nth-child(1)
{ width: 70px; text-align: center; }
/* MODEL */
.data-table th:nth-child(2),
.data-table td:nth-child(2)
{ width: 80px; text-align: center; }
/* MUSTERI */
.data-table th:nth-child(3),
.data-table td:nth-child(3)
{ width: 150px; }
/* DEVICE ID */
.data-table th:nth-child(4),
.data-table td:nth-child(4)
{ width: 160px; text-align: center; }
/* KREDI */
.data-table th:nth-child(5) { width: 50px; text-align: right; }
.data-table td:nth-child(5) { text-align: right; }
/* KREDI DURUMU */
.data-table th:nth-child(6) { width: 50px; text-align: center; }
/* TARIH */
.data-table th:nth-child(7) { width: 90px; }
/* ISLEMLER */
.data-table th:nth-child(8),
.data-table td:nth-child(8) { width: 140px; text-align: center; }

.data-table td:nth-child(6) {
    text-align: center;
}

.data-table tbody tr:hover {
    background: var(--bg);
}

.dashboard-events-table th:nth-child(1),
.dashboard-events-table td:nth-child(1) {
    width: 130px;
    max-width: 130px;
    text-align: center;
}

.dashboard-events-table th:nth-child(2),
.dashboard-events-table td:nth-child(2) {
    width: 100px;
    max-width: 100px;
    text-align: center;
}

.dashboard-events-table th:nth-child(3),
.dashboard-events-table td:nth-child(3) {
    width: 140px;
    max-width: 140px;
    text-align: left;
}

.dashboard-events-table th:nth-child(4),
.dashboard-events-table td:nth-child(4) {
    width: auto;
    text-align: left;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 0.2s;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-danger {
    background: var(--danger);
}

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

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.system-status {
    display: flex;
    gap: 2rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-label {
    font-weight: 500;
    color: var(--text-light);
}

.status-value {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-value.ok {
    background: #dcfce7;
    color: #166534;
}

.status-value.error {
    background: #fee2e2;
    color: #991b1b;
}

.status-value.loading {
    background: #fef3c7;
    color: #92400e;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.success-message {
    background: #dcfce7;
    color: #166534;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.device-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.device-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.device-card-title {
    font-weight: 600;
}

.device-card-status {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.device-card-status.active {
    background: #dcfce7;
    color: #166534;
}

.device-card-status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.device-card-info {
    font-size: 0.875rem;
    color: var(--text-light);
}

.device-card-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-light);
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

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

.status-badge.status-1 {
    background: #dcfce7;
    color: #166534;
}

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

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

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

.credit-warning {
    background: #fee2e2 !important;
    color: #991b1b !important;
    font-weight: 700;
}

.row-bozuk td {
    opacity: 0.6;
}

.badge-bozuk {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 4px;
    padding: 1px 5px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Users Tablosu - Agresif Kompakt Düzen */
table.users-compact {
    table-layout: fixed;
    width: 100%;
}

table.users-compact th,
table.users-compact td {
    padding: 0.25rem 0.3rem !important;
    font-size: 0.8rem !important;
}

table.users-compact th:nth-child(1),
table.users-compact td:nth-child(1) { 
    width: 25%; 
    text-align: left;
} /* İsim */

table.users-compact th:nth-child(2),
table.users-compact td:nth-child(2) { 
    width: 10%; 
    text-align: center;
} /* Aktif */

table.users-compact th:nth-child(3),
table.users-compact td:nth-child(3) { 
    width: 8%; 
    text-align: center;
    font-size: 0.75rem !important;
} /* Kurulum - çok dar */

table.users-compact th:nth-child(4),
table.users-compact td:nth-child(4) { 
    width: 15%; 
    text-align: center;
} /* Son Kurulum */

table.users-compact th:nth-child(5),
table.users-compact td:nth-child(5) { 
    width: 42%; 
    text-align: center;
} /* İşlemler - geniş */

table.users-compact .col-narrow {
    font-size: 0.75rem;
    padding: 0.2rem;
}

table.users-compact .col-wide {
    text-align: center;
}

/* Users butonları - ultra kompakt */
table.users-compact .btn-small {
    padding: 0.15rem 0.35rem !important;
    font-size: 0.7rem !important;
    margin: 0 0.05rem;
    white-space: nowrap;
}

/* Service Passwords Tablosu - Kompakt Düzen */
table.service-compact {
    table-layout: fixed;
    width: 100%;
}

table.service-compact th,
table.service-compact td {
    padding: 0.3rem 0.4rem !important;
    font-size: 0.85rem !important;
}

table.service-compact th:nth-child(1),
table.service-compact td:nth-child(1) { 
    width: 8%; 
    text-align: center;
} /* ID - dar */

table.service-compact th:nth-child(2),
table.service-compact td:nth-child(2) { 
    width: 40%; 
    text-align: left;
    font-family: monospace;
    font-size: 0.8rem;
} /* Şifre - monospace */

table.service-compact th:nth-child(3),
table.service-compact td:nth-child(3) { 
    width: 20%; 
    text-align: center;
} /* Son Kullanma */

table.service-compact th:nth-child(4),
table.service-compact td:nth-child(4) { 
    width: 32%; 
    text-align: center;
} /* İşlemler - geniş */

table.service-compact .col-narrow {
    font-size: 0.75rem;
}

table.service-compact .col-wide {
    text-align: center;
}

table.service-compact .btn-small {
    padding: 0.2rem 0.4rem !important;
    font-size: 0.75rem !important;
    margin: 0 0.1rem;
    white-space: nowrap;
}

/* Cihaz Durumu - Sağlam/Bozuk */
.status-badge.status-ok {
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
}

.status-badge.status-broken {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 700;
}

/* MakeARGES Dialog - Aksesuar Checkbox Stilleri */
#ma-accessories-list label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--surface);
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

#ma-accessories-list label:hover {
    background: var(--border);
}

#ma-accessories-list input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* makearges.html - Aksesuar Checkbox Stilleri */
#accessories-list label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--surface);
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

#accessories-list label:hover {
    background: var(--border);
}

#accessories-list input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}
