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

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
    line-height: 1.5;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #111827;
    color: #fff;
    padding: 1.5rem 1rem;
    flex-shrink: 0;
}

.brand h1 {
    margin: 0;
    font-size: 1.25rem;
}

.brand p {
    margin: 0.25rem 0 1.5rem;
    color: #9ca3af;
    font-size: 0.875rem;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav a {
    color: #e5e7eb;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    text-decoration: none;
}

.nav a:hover,
.nav a.active {
    background: #2563eb;
    color: #fff;
    text-decoration: none;
}

.user-info {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #374151;
    font-size: 0.875rem;
}

.user-info small {
    display: block;
    color: #9ca3af;
}

.content {
    flex: 1;
    padding: 1.5rem;
    max-width: 100%;
    overflow-x: auto;
}

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

.page-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.btn {
    display: inline-block;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.9375rem;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
    text-decoration: none;
    color: #fff;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-secondary:hover {
    background: #d1d5db;
    text-decoration: none;
    color: #111827;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    text-decoration: none;
    color: #fff;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
}

.btn-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.filter-hint {
    margin: 0 0 1rem;
    color: #6b7280;
    font-size: 0.9375rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.55rem 0.65rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9375rem;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background: #f9fafb;
}

th,
td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

th {
    font-weight: 600;
    white-space: nowrap;
}

th.col-date,
td.col-date {
    white-space: nowrap;
    min-width: 6.75rem;
}

.summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    font-weight: 600;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.login-card h1 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
}

.login-card p {
    margin: 0 0 1.5rem;
    color: #6b7280;
}

.error-text {
    color: #dc2626;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Yazdırma / PDF — yatay (landscape) */
@media print {
    body {
        background: #fff;
    }

    body.print-landscape {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sidebar,
    .no-print,
    .alert {
        display: none !important;
    }

    .layout {
        display: block;
    }

    .content {
        padding: 0;
        max-width: none;
    }

    .card {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .print-page-landscape {
        max-width: none;
        width: 100%;
        padding: 0;
    }

    .print-table {
        font-size: 10px;
        table-layout: fixed;
        width: 100%;
    }

    .print-table th,
    .print-table td {
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        padding: 4px 6px;
    }

    .print-table .col-wide {
        width: 15%;
    }

    .print-table .col-date {
        width: 9%;
        white-space: nowrap;
    }

    .print-table .col-narrow {
        width: 7%;
    }

    @page {
        size: A4 landscape;
        margin: 10mm;
    }
}

.print-page {
    max-width: 210mm;
    margin: 0 auto;
    background: #fff;
    padding: 1rem;
}

.print-page-landscape {
    max-width: 297mm;
}

.print-table {
    table-layout: fixed;
    width: 100%;
}

.print-table .col-wide {
    width: 15%;
}

.print-table .col-date {
    width: 9%;
    white-space: nowrap;
}

.print-table .col-narrow {
    width: 7%;
}

.print-table th,
.print-table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.print-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.print-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
}

.print-header p {
    margin: 0;
    color: #4b5563;
    font-size: 0.875rem;
}

.print-summary {
    margin-top: 1rem;
    font-weight: 600;
}

.log-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.log-badge-created {
    background: #ecfdf5;
    color: #065f46;
}

.log-badge-updated {
    background: #eff6ff;
    color: #1d4ed8;
}

.log-badge-deleted {
    background: #fef2f2;
    color: #991b1b;
}

.log-details {
    margin: 0.5rem 0 0;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 420px;
}
