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

:root {
    --primary: #6b2c91;
    --primary-dark: #542174;
    --primary-soft: #f3e8fb;
    --gold: #d4af37;
    --gold-soft: #f6ebc3;
    --surface: #ffffff;
    --surface-soft: #f8f9fc;
    --border: #e8e8f2;
    --text: #1f2430;
    --muted: #62697a;
    --danger: #dc3545;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at 0% 0%, #f1e5ff, #f7f8fc 45%, #eef2ff 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 12% 8%, rgba(212, 175, 55, 0.14), transparent 40%),
        radial-gradient(circle at 88% 6%, rgba(122, 74, 191, 0.16), transparent 38%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 28px 24px 34px;
}

h1 {
    color: var(--text);
    font-size: 31px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h2 {
    color: var(--text);
    margin-bottom: 14px;
    font-size: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.page-header {
    background: linear-gradient(135deg, rgba(107, 44, 145, 0.95), rgba(84, 33, 116, 0.95));
    border-radius: 20px;
    color: #fff;
    padding: 24px 24px 20px;
    margin-bottom: 22px;
    box-shadow: 0 14px 44px rgba(61, 28, 88, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.page-header::after {
    content: "";
    position: absolute;
    width: 320px;
    height: 320px;
    right: -70px;
    top: -220px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.32), transparent 65%);
    transform: rotate(20deg);
    pointer-events: none;
}

.header-badge {
    width: fit-content;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 10px;
}

.page-header h1 {
    color: #fff;
    margin-bottom: 8px;
}

.page-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.title-favicon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    padding: 3px;
}

.header-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.88);
    max-width: 860px;
}

::placeholder {
    color: rgba(85, 93, 110, 0.5);
}

/* Ana İçerik */
.main-content {
    display: grid;
    grid-template-columns: minmax(340px, 1fr) minmax(620px, 1.45fr);
    gap: 22px;
    align-items: start;
}

.panel {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 22px 42px rgba(23, 25, 38, 0.11);
    backdrop-filter: blur(10px);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 28px 48px rgba(23, 25, 38, 0.14);
}

.left-panel {
    max-width: 100%;
}

.right-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: sticky;
    top: 18px;
}

/* Form Stilleri */
.form-section {
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
    position: relative;
}

.form-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(90deg, rgba(107, 44, 145, 0.55), rgba(212, 175, 55, 0.55));
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 12px;
    flex: 1;
}

.form-row {
    display: flex;
    gap: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--muted);
    font-size: 13px;
}

input[type="text"],
select,
input[type="file"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d6d9e3;
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.15s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(107, 44, 145, 0.12);
    transform: translateY(-1px);
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(107, 44, 145, 0.12);
    transform: translateY(-1px);
}

input[type="file"]::file-selector-button {
    border: 1px solid #d6d9e3;
    border-radius: 8px;
    padding: 5px 10px;
    background: #f8f8fe;
    color: #333;
    margin-right: 8px;
    cursor: pointer;
}

/* Buton Stilleri */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.btn {
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #7e36ab);
    color: white;
    box-shadow: 0 7px 18px rgba(107, 44, 145, 0.28);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4e1e6a, #6a2b90);
    transform: translateY(-2px);
    box-shadow: 0 11px 22px rgba(90, 37, 122, 0.35);
}

.btn-secondary {
    background: #f3f4fa;
    border-color: #d9dceb;
    color: #2f3444;
}

.btn-secondary:hover {
    background: #e9ecf8;
    transform: translateY(-2px);
}

/* Personel Listesi */
.personel-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee1ee;
    border-radius: 10px;
    padding: 10px;
    background: #fcfcff;
}

.personel-list::-webkit-scrollbar {
    width: 10px;
}

.personel-list::-webkit-scrollbar-track {
    background: #f0f2fb;
    border-radius: 999px;
}

.personel-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #c9b1db, #9f7fbc);
    border-radius: 999px;
}

.personel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 10px;
    margin-bottom: 5px;
    background: #f5f6fc;
    border: 1px solid #eceefa;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.personel-item:hover {
    background: #eef0fa;
    border-color: #dfe3f2;
}

.personel-item.active {
    background: #efe3f6;
    border-color: #d8bde8;
    box-shadow: inset 3px 0 0 var(--primary);
}

.personel-item-info {
    flex: 1;
}

.personel-item-name {
    font-weight: 600;
    color: #2a3141;
}

.personel-item-actions {
    display: flex;
    gap: 5px;
}

.personel-item-btn {
    padding: 4px 8px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

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

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

.empty-message {
    color: #7c8498;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* Kart Container */
.kart-container {
    display: flex;
    gap: 0.1cm;
    margin: 14px 0;
    padding: 18px;
    background: linear-gradient(180deg, #f3f5fd 0%, #e7ebf9 100%);
    border: 1px solid #dde2f3;
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 12px 24px rgba(26, 33, 56, 0.08);
}

/* Kart Wrapper - Katlanabilir kart için */
.kart-wrapper {
    display: flex;
    border: 2px solid #6b2c91;
}

/* Kart Temel Stilleri - Gerçek Boyut */
.kart {
    width: 8.5cm;
    height: 6cm;
    background: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(30, 35, 53, 0.25);
    border-radius: 0;
    box-sizing: border-box;
}

.on-yuz {
    border: 3px solid #6b2c91;
    border-radius: 0;
    padding: 1mm;
    box-sizing: border-box;
}

.arka-yuz {
    border: 3px solid #6b2c91;
    border-radius: 0;
    padding: 1mm;
    box-sizing: border-box;
}

/* Ön Yüz Stilleri */
.on-yuz {
    display: flex;
    flex-direction: column;
}

.kart-header {
    background: linear-gradient(135deg, #6b2c91 0%, #572277 72%, #4d1b6c 100%);
    color: white;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 1.65cm;
    position: relative;
    overflow: hidden;
}

.kart-header::after {
    content: "";
    position: absolute;
    right: -18%;
    top: -55%;
    width: 42%;
    height: 180%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(22deg);
}

.logo-container {
    width: 0.9cm;
    height: 0.9cm;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 50%;
    padding: 0.06cm;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sol-logo,
.sag-logo {
    filter: none;
}

.header-text {
    text-align: center;
    flex: 1;
    padding: 0 5px;
}

.ministry {
    font-size: 9px;
    font-weight: bold;
    margin-bottom: 1px;
    letter-spacing: 0.5px;
}

.card-type {
    font-size: 7.8px;
    line-height: 1.2;
}

.kurum-adi {
    text-align: center;
    padding: 4px;
    border-bottom: 1px solid #6b2c91;
    font-weight: bold;
    font-size: 10px;
    color: #1f2430;
    height: 0.6cm;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kart-body {
    display: flex;
    flex: 1;
    padding: 6px;
    gap: 8px;
}

.fotograf-alani {
    width: 2.2cm;
    height: 2.8cm;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.fotograf-alani img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.fotograf-yazi {
    position: absolute;
    font-size: 9px;
    color: #666;
    background: rgba(255,255,255,0.8);
    padding: 2px 4px;
}

.fotograf-alani img:not([src=""]) + .fotograf-yazi {
    display: none;
}

.bilgi-tablosu {
    flex: 1;
}

.bilgi-tablosu table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9px;
}

.bilgi-tablosu td {
    border: 1px solid #333;
    padding: 3px 5px;
    height: 0.45cm;
}

.bilgi-tablosu .label {
    background: #f4eef9;
    font-weight: bold;
    width: 35%;
    font-size: 8px;
    color: #4e2d65;
}

.bilgi-tablosu .value {
    font-size: 9px;
}

/* Arka Yüz Stilleri */
.arka-yuz {
    display: flex;
    flex-direction: column;
    border: 3px solid #6b2c91;
}

.nufus-header {
    background: white;
    text-align: center;
    padding: 4px;
    border-bottom: 2px solid #6b2c91;
    position: relative;
}

.nufus-header h3 {
    font-size: 11px;
    color: #333;
    margin: 0;
    font-weight: bold;
    letter-spacing: 0.02em;
}

.nufus-body {
    flex: 1;
    padding: 6px;
    display: flex;
    flex-direction: column;
}

.nufus-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9px;
}

.nufus-body td {
    border: 1px solid #333;
    padding: 3px 5px;
    height: 0.55cm;
}

.nufus-body .label {
    background: #f4eef9;
    font-weight: bold;
    width: 40%;
    font-size: 8px;
    color: #4e2d65;
}

.nufus-body .value {
    font-size: 9px;
}

.cilt-inline-fields {
    display: flex;
    gap: 0.08cm;
    margin-top: 0.07cm;
}

.cilt-inline-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.05cm;
    min-width: 0;
}

.cilt-inline-label {
    font-size: 6px;
    font-weight: 700;
    white-space: nowrap;
    color: #4e2d65;
}

.cilt-inline-value {
    flex: 1;
    min-width: 0.95cm;
    height: 0.36cm;
    border: 1px solid #333;
    background: #fff;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.imza-alani {
    margin-top: auto;
    display: flex;
    align-items: center;
    padding-top: 2px;
    height: 0.56cm;
}

.imza-sol {
    width: 20%;
    text-align: center;
}

.imza-sag {
    width: 80%;
    padding-left: 3px;
}

.imza-yazi {
    font-size: 7px;
    color: #333;
    font-weight: bold;
}

.imza-kutusu {
    width: 100%;
    height: 0.42cm;
    border: 1px solid #333;
    background: white;
}

/* Çıktı Butonları */
.output-buttons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    width: 100%;
    justify-content: center;
}

.output-buttons .btn {
    min-width: 140px;
    font-size: 15px;
}

.pdf-export-mode .kart-container {
    box-shadow: none !important;
    background: #fff !important;
    border: none !important;
    padding: 0 !important;
    gap: 0 !important;
}

.pdf-export-mode .kart {
    width: 89.5mm !important;
    height: 60mm !important;
    box-shadow: none !important;
    outline: none !important;
    filter: none !important;
    overflow: hidden !important;
}

.preview-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.preview-navigation .btn {
    min-width: 44px;
    padding: 8px 12px;
}

.preview-counter {
    min-width: 70px;
    text-align: center;
    font-weight: 700;
    color: #3b4153;
}

.preview-navigation .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.site-footer {
    margin-top: 28px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 20px;
    backdrop-filter: blur(8px);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-brand {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary-dark);
    text-decoration: none;
}

.footer-sep {
    color: #c0b8ca;
    margin: 0 2px;
}

.footer-nav {
    display: flex;
    gap: 8px;
}

.footer-link {
    background: linear-gradient(135deg, var(--primary), #7e36ab);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(107, 44, 145, 0.22);
}

.footer-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(107, 44, 145, 0.32);
}

.toast-container {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    min-width: 260px;
    max-width: 360px;
    padding: 11px 14px;
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(27, 30, 45, 0.26);
    animation: toastIn 0.25s ease;
}

.toast-success {
    background: linear-gradient(135deg, #1f9d61, #138a53);
}

.toast-error {
    background: linear-gradient(135deg, #d9534f, #c43d39);
}

.toast-info {
    background: linear-gradient(135deg, #6b2c91, #5a257a);
}

@keyframes toastIn {
    from { transform: translateY(8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-dialog {
    border: none;
    border-radius: 18px;
    padding: 0;
    max-width: 640px;
    width: 92%;
    box-shadow: 0 24px 60px rgba(20, 20, 40, 0.25);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-dialog::backdrop {
    background: rgba(20, 18, 30, 0.45);
    backdrop-filter: blur(4px);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary), #7e36ab);
    color: #fff;
    border-radius: 18px 18px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 17px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.modal-body {
    padding: 20px;
    max-height: 65vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.7;
    color: #30374b;
}

.modal-body ul {
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 8px;
}

.modal-body p {
    margin-bottom: 12px;
}

.warning-note {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff4f4;
    border: 1px solid #f3c3c3;
    color: #8d1f1f;
    font-size: 13px;
    line-height: 1.6;
}

/* Yazdırma Stilleri - A4 Sayfasına 5 Kart */
@media print {
    @page {
        size: A4 portrait;
        margin: 8mm;
    }
    
    body {
        background: white;
    }
    
    .page-header,
    .left-panel,
    .right-panel h2,
    .output-buttons,
    .preview-navigation,
    .site-footer,
    .toast-container {
        display: none !important;
    }

    .container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .main-content {
        display: block;
    }
    
    .right-panel {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
        border: none !important;
    }
    
    .kart-container {
        display: flex;
        position: static;
        width: 180mm;
        gap: 1mm;
        flex-direction: row !important;
        align-items: flex-start !important;
        background: white !important;
        padding: 0;
        margin: 0;
        box-shadow: none !important;
        border: none !important;
        position: relative !important;
    }

    .kart-container::after {
        content: "";
        position: absolute;
        top: -1.5mm;
        bottom: -1.5mm;
        left: 90mm;
        border-left: 0.15mm dashed rgba(0, 0, 0, 0.22);
    }
    
    .kart {
        display: inline-block;
        width: 89.5mm !important;
        height: 60mm !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        background: #fff !important;
        box-shadow: none;
        page-break-inside: avoid;
        margin-bottom: 0;
        margin-right: 0;
        outline: none;
    }
    
    .on-yuz {
        border: 2.2pt solid #6b2c91;
        border-radius: 0 !important;
    }
    
    .arka-yuz {
        border: 2.2pt solid #6b2c91;
        border-radius: 0 !important;
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .kart-container {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .right-panel {
        position: static;
    }
}

@media (max-width: 780px) {
    .container {
        padding: 16px;
    }

    .page-header {
        padding: 18px;
        border-radius: 16px;
    }

    h1 {
        font-size: 24px;
    }

    .form-row {
        flex-direction: column;
        gap: 8px;
    }

    .output-buttons {
        flex-wrap: wrap;
    }

    .preview-navigation {
        margin-top: 10px;
    }
}
