@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --secondary: #f1f5f9;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --error: #ef4444;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -5px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f0f4ff 0%, #f8fafc 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ─── HEADER ─────────────────────────────────────────── */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.3px;
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--error-bg);
    color: var(--error-text);
    border-radius: var(--radius-xs);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 1px solid #fca5a5;
}

.logout-btn:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

/* ─── CONTAINER ──────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* ─── CARD ───────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 20px;
}

/* ─── ACTION BAR ─────────────────────────────────────── */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.action-bar h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    min-width: 0;
    flex-shrink: 1;
}

.action-bar h2 a {
    color: inherit;
    text-decoration: none;
}

.action-bar .btn-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ─── BUTTONS ────────────────────────────────────────── */
.btn, button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn:hover, button[type="submit"]:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59,130,246,0.35);
}

.btn:active, button[type="submit"]:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--text);
    box-shadow: none;
}

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

.btn-warning:hover {
    background: #d97706;
    box-shadow: 0 4px 12px rgba(245,158,11,0.35);
}

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

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239,68,68,0.35);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-full {
    width: 100%;
}

/* ─── FORM ───────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
    outline: none;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

/* ─── SEARCH BAR ─────────────────────────────────────── */
.search-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    background: var(--secondary);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.search-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.search-actions {
    display: flex;
    gap: 8px;
}

.search-actions .btn,
.search-actions button {
    flex: 1;
}

/* ─── TABLE ──────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
}

thead {
    background: var(--secondary);
}

th {
    text-align: left;
    padding: 12px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1.5px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--primary-light);
}

tbody tr {
    transition: background 0.15s;
}

/* ─── MOBILE CARDS (table rows as cards) ─────────────── */
@media (max-width: 640px) {
    .table-wrapper {
        border: none;
        background: transparent;
    }

    table {
        min-width: unset;
    }

    thead {
        display: none;
    }

    tbody tr {
        display: block;
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        margin-bottom: 10px;
        padding: 14px;
        box-shadow: var(--shadow-sm);
    }

    tbody tr:hover {
        background: var(--white);
        border-color: var(--primary);
    }

    /* Her td bir satır */
    td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 5px 0;
        border-bottom: none;
        font-size: 0.875rem;
        gap: 8px;
    }

    td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.4px;
        min-width: 70px;
        flex-shrink: 0;
        padding-top: 2px;
    }

    /* İşlemler hücresi: butonları alta al, tam genişlik */
    td[data-label="İşlem"] {
        flex-direction: column;
        align-items: stretch;
        padding-top: 10px;
        margin-top: 4px;
        border-top: 1px dashed var(--border);
    }

    td[data-label="İşlem"]::before {
        display: none;
    }

    td[data-label="İşlem"] > div {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    td[data-label="İşlem"] .btn {
        text-align: center;
        justify-content: center;
    }

    td:first-child {
        padding-bottom: 6px;
        margin-bottom: 4px;
        border-bottom: 1px dashed var(--border);
    }

    td a {
        font-weight: 600;
    }

    .search-row {
        grid-template-columns: 1fr;
    }

    /* Action bar butonları mobilde tam genişlik */
    .action-bar {
        flex-direction: row;
        align-items: center;
    }

    .action-bar .btn-group {
        flex-shrink: 0;
    }
}

/* ─── TABLE LINKS ────────────────────────────────────── */
table a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

table a:hover {
    text-decoration: underline;
}

/* ─── ALERTS ─────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #a7f3d0;
}

.alert.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #fca5a5;
}

.alert.warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid #fde68a;
}

/* ─── PAGINATION ─────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 20px;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.pagination a.active, .pagination span.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination a:hover:not(.active) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* ─── EMPTY STATE ────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-style: italic;
}

/* ─── LOGIN PAGE ─────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 24px;
}

/* ─── DETAIL PAGE ─────────────────────────────────────── */

/* Profil avatar */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(59,130,246,0.35);
    letter-spacing: -1px;
}

.profile-meta {
    min-width: 0;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}

.profile-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.profile-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    margin-top: 8px;
}

/* Info grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.info-item:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.08);
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.info-label .icon {
    font-size: 0.9rem;
}

.info-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
    line-height: 1.5;
}

.info-value.empty {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

/* Footer meta */
.detail-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
    .info-item.full-width {
        grid-column: 1;
    }
    .profile-avatar {
        width: 52px;
        height: 52px;
        font-size: 1.3rem;
    }
    .profile-name {
        font-size: 1.1rem;
    }
}

/* ─── HEADER LINKS (backwards compat) ───────────────── */
.header-links {
    text-decoration: none;
    color: inherit;
}

/* ─── FORM PAGE ──────────────────────────────────────── */
.form-card {
    max-width: 640px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 520px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .card {
        padding: 14px;
    }
    .login-card {
        padding: 28px 20px;
    }
    .btn, button[type="submit"] {
        padding: 10px 14px;
        font-size: 0.82rem;
    }
    .btn-sm {
        padding: 7px 10px;
        font-size: 0.78rem;
    }
    .container {
        padding: 12px 10px;
    }
}

/* ─── PAGE TITLE ─────────────────────────────────────── */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
}

/* ─── BADGE ──────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}
