:root {
    --primary: #123b63;
    --primary-light: #eaf2f9;
    --accent: #c9a227;
    --background: #f4f7fa;
    --surface: #ffffff;
    --text: #172534;
    --muted: #66788a;
    --border: #dce4eb;
    --success: #198754;
    --danger: #c73e3e;
    --warning: #d98b00;
    --radius: 14px;
    --shadow: 0 5px 20px rgba(18, 59, 99, .08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: #092c4d;
}

.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(18, 59, 99, .05);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
}

.navbar-brand img,
.brand-logo {
    width: auto;
    max-width: 150px;
    max-height: 48px;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-text small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 500;
}

.nav-link {
    color: #334a60;
    font-weight: 600;
    border-radius: 9px;
    padding: .65rem .8rem !important;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

main,
.main-content {
    min-height: calc(100vh - 76px);
}

.page-container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 50px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.page-head h1,
.page-title {
    margin: 0;
    color: var(--primary);
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 750;
}

.page-head p,
.page-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.card,
.panel,
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    overflow: hidden;
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--primary);
    font-weight: 700;
}

.panel {
    padding: 22px;
}

.stat-card {
    height: 100%;
    padding: 20px;
    border-left: 4px solid var(--primary);
}

.stat-card span,
.stat-card small {
    display: block;
    color: var(--muted);
    font-size: .88rem;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    color: var(--primary);
    font-size: 1.8rem;
    line-height: 1;
}

.stat-success {
    border-left-color: var(--success);
}

.stat-warning {
    border-left-color: var(--warning);
}

.stat-danger {
    border-left-color: var(--danger);
}

.btn {
    border-radius: 9px;
    font-weight: 650;
    padding: .65rem 1rem;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background: #092f52;
    border-color: #092f52;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.form-label {
    color: #294259;
    font-weight: 650;
}

.form-control,
.form-select {
    min-height: 46px;
    border-color: #cbd7e1;
    border-radius: 9px;
}

textarea.form-control {
    min-height: 110px;
}

.form-control:focus,
.form-select:focus {
    border-color: #5c88ad;
    box-shadow: 0 0 0 .2rem rgba(18, 59, 99, .12);
}

.table {
    margin-bottom: 0;
}

.table th {
    color: #40566b;
    background: #f8fafc;
    font-size: .84rem;
    white-space: nowrap;
}

.table td {
    color: #26394b;
    vertical-align: middle;
}

.badge {
    border-radius: 20px;
    padding: .48rem .65rem;
    font-weight: 650;
}

.alert {
    border-radius: 10px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, #e2eef8, transparent 38%),
        var(--background);
}

.login-card {
    width: min(440px, 100%);
    padding: 12px;
}

.login-card .card-body {
    padding: clamp(22px, 5vw, 38px);
}

.login-heading {
    margin-bottom: 28px;
    text-align: center;
}

.login-heading img {
    max-width: 190px;
    max-height: 78px;
    margin-bottom: 18px;
    object-fit: contain;
}

.login-heading h1 {
    color: var(--primary);
    font-size: 1.55rem;
    font-weight: 750;
}

.login-heading p {
    color: var(--muted);
}

.empty-state,
.error-page,
.offline-page {
    max-width: 650px;
    margin: 60px auto;
    padding: 38px 24px;
    text-align: center;
}

.empty-state h2,
.error-page h1,
.offline-page h1 {
    color: var(--primary);
}

.install-button {
    display: none;
}

.mobile-action {
    display: none;
}

footer {
    color: var(--muted);
    font-size: .82rem;
    text-align: center;
    padding: 20px;
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        margin-top: 12px;
        padding: 12px;
        background: #f8fafc;
        border: 1px solid var(--border);
        border-radius: 12px;
    }

    .page-container {
        width: min(100% - 22px, 1180px);
        padding-top: 20px;
    }

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

    .page-head > .btn,
    .page-head > a.btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    body {
        font-size: .94rem;
    }

    .navbar-brand img,
    .brand-logo {
        max-width: 118px;
        max-height: 42px;
    }

    .brand-text strong {
        font-size: .9rem;
    }

    .panel,
    .stat-card {
        padding: 16px;
    }

    .card {
        border-radius: 11px;
    }

    .btn {
        min-height: 45px;
    }

    .table-responsive {
        border-radius: 10px;
    }

    .mobile-action {
        display: block;
        position: fixed;
        right: 18px;
        bottom: 18px;
        z-index: 1040;
    }
}

@media (display-mode: standalone) {
    .install-button {
        display: none !important;
    }

    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Kurumsal logonun giriş ekranına güvenli biçimde sığması */
.login-card img,
.login-card img[src*="kurumsal-logo"],
.login-page img[src*="kurumsal-logo"] {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: min(100%, 280px) !important;
    max-height: 90px !important;
    margin: 0 auto 18px !important;
    object-fit: contain;
}

/* Form soru oluşturucu */
.question-list {
    display: grid;
    gap: 14px;
}

.question-card {
    display: flex;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.question-number {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 750;
}

.question-body {
    min-width: 0;
    flex: 1;
}

.option-preview {
    display: grid;
    gap: 7px;
    color: var(--muted);
}

.answer-preview {
    margin-top: 14px;
    padding: 10px 0;
    color: #8291a0;
    border-bottom: 1px dashed #aebbc6;
}

.answer-long {
    min-height: 62px;
}

.question-setting {
    margin-bottom: 16px;
    padding: 14px;
    background: #f7f9fb;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.sticky-question-panel {
    position: sticky;
    top: 92px;
}

@media (max-width: 991.98px) {
    .sticky-question-panel {
        position: static;
    }
}

.question-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.question-actions form {
    display: inline-flex;
}

@media (max-width: 575.98px) {
    .question-card {
        align-items: flex-start;
    }

    .question-actions {
        justify-content: flex-start;
        margin-top: 10px;
    }
}

.form-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.form-toolbar form {
    display: inline-flex;
}

.public-form-page {
    width: min(760px, calc(100% - 24px));
    margin: 28px auto 60px;
}

.public-form-header {
    margin-bottom: 20px;
    padding: 26px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--border);
    border-top: 7px solid var(--primary);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.public-form-header > img:first-child {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100%, 280px);
    max-height: 85px;
    margin: 0 auto 20px;
    object-fit: contain;
}

.public-form-banner-frame {
    width: 100%;
    aspect-ratio: 4 / 1;
    margin: 0 auto 22px;
    overflow: hidden;
    background: #eef2f5;
    border-radius: 10px;
}

.public-form-banner {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.public-form-header h1 {
    margin: 0;
    color: var(--primary);
    font-size: clamp(1.55rem, 4vw, 2.2rem);
}

.public-form-description {
    margin: 20px auto 0;
    padding: 16px 18px;
    color: #475b6e;
    font-size: .98rem;
    line-height: 1.65;
    text-align: left;
    white-space: pre-line;
    background: #f7f9fb;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 10px;
}

.public-form-unit {
    margin-top: 14px;
    color: var(--primary);
    font-size: .88rem;
    font-weight: 700;
}

.public-question-list {
    display: grid;
    gap: 14px;
}

.public-question {
    padding: 22px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 13px;
    box-shadow: var(--shadow);
}

.public-question-title {
    display: block;
    margin-bottom: 12px;
    color: var(--text);
    font-weight: 700;
}

.public-preview-note {
    margin-top: 18px;
    padding: 14px;
    color: var(--muted);
    text-align: center;
    background: #edf3f8;
    border-radius: 10px;
}

@media (max-width: 575.98px) {
    .form-toolbar {
        width: 100%;
    }

    .form-toolbar > a,
    .form-toolbar > form,
    .form-toolbar button {
        width: 100%;
    }

    .public-form-header,
    .public-question {
        padding: 18px;
    }
}

.identity-section {
    border-left: 4px solid var(--primary);
}

.kvkk-text {
    max-height: 180px;
    overflow-y: auto;
    padding: 14px;
    color: #475b6e;
    white-space: pre-line;
    background: #f7f9fb;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.success-document {
    text-align: center;
}

.success-document > img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100%, 280px);
    max-height: 85px;
    margin: 0 auto 20px;
    object-fit: contain;
}

.success-icon {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    color: #fff;
    background: var(--success);
    border-radius: 50%;
    font-size: 2rem;
    font-weight: 800;
}

.registration-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 24px;
    text-align: left;
}

.registration-info > div {
    padding: 14px;
    background: #f7f9fb;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.registration-info small,
.registration-info strong {
    display: block;
}

.registration-info small {
    margin-bottom: 4px;
    color: var(--muted);
}

@media (max-width: 575.98px) {
    .registration-info {
        grid-template-columns: 1fr;
    }
}

@media print {
    nav,
    .btn,
    .alert {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .success-document {
        border: 0;
        box-shadow: none;
    }
}

.detail-list,
.answer-list {
    display: grid;
    gap: 12px;
}

.detail-list > div,
.answer-item {
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.detail-list small,
.detail-list strong,
.answer-item small,
.answer-item strong {
    display: block;
}

.detail-list small,
.answer-item small {
    margin-bottom: 5px;
    color: var(--muted);
}

.settings-banner {
    display: block;
    width: min(100%, 360px);
    max-height: 150px;
    border: 1px solid var(--border);
    border-radius: 9px;
    object-fit: cover;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.table-actions form {
    display: inline-flex;
}

@media (max-width: 575.98px) {
    .table-actions {
        min-width: 190px;
    }
}


.rich-text-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 9px;
    background: #f7f9fb;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 9px 9px 0 0;
}

.rich-text-color-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 31px;
    padding: 3px 8px;
    color: #475b6e;
    font-size: .85rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.rich-text-color-label input {
    width: 28px;
    height: 24px;
    padding: 0;
    border: 0;
    cursor: pointer;
}

.rich-text-editor {
    display: block;
    width: 100%;
    height: 280px;
    min-height: 280px;
    padding: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    color: #263b50;
    line-height: 1.6;
    white-space: pre-wrap;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 9px 9px;
    outline: none;
}

.rich-text-editor:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 50, 79, .12);
}

.rich-text-editor ul,
.rich-text-editor ol,
.public-form-description ul,
.public-form-description ol {
    margin: 8px 0 8px 24px;
    padding-left: 14px;
}

.rich-text-editor p,
.public-form-description p {
    margin: 0 0 8px;
}

.rich-text-editor a,
.public-form-description a {
    color: #0d6efd;
    text-decoration: underline;
}


.rich-text-size {
    width: auto;
    min-width: 125px;
}


/* Form oluşturma ve ayar ekranı kategorileri */
.settings-form {
    display: block;
}

.settings-section {
    border-left: 4px solid var(--primary);
}

.settings-section > h2 {
    color: var(--primary);
}

.settings-section > .text-muted {
    max-width: 850px;
}

.settings-actions {
    position: sticky;
    bottom: 12px;
    z-index: 20;
}

@media (max-width: 767.98px) {
    .settings-actions {
        position: static;
    }
}

/* Son incelenen satır üst menünün altında kalmasın. */
tr[id^="basvuru-"] {
    scroll-margin-top: 110px;
}

/* Başvuru listesinde kompakt aktif filtre özeti. */
#basvuruFiltreFormu {
    scroll-margin-top: 90px;
}

.filter-sticky-summary {
    position: sticky;
    top: 76px;
    z-index: 1010;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

@media (max-width: 767.98px) {
    .filter-sticky-summary {
        top: 66px;
        padding: 10px 12px;
        font-size: .9rem;
    }
}

/* Sayfa geçişinde başvuru listesi menünün altında açılsın. */
#basvuruListesi {
    scroll-margin-top: 90px;
}
