/* QMS — Çetinkaya Tavukçuluk arayüz */

body {
    background-color: #f4f6f8;
    font-size: 15px;
    color: #1a1d21;
    padding-bottom: 0;
}

:root {
    --qms-brand: #0b3d2e;
    --qms-brand-light: #145a43;
    --qms-accent: #c4a35a;
    --qms-surface: #ffffff;
    --qms-danger: #c0392b;
    --qms-success: #1e7e4a;
    --qms-touch: 44px;
}

/* ── Navbar ── */
.navbar-dark.bg-dark,
.navbar.qms-navbar {
    background-color: var(--qms-brand) !important;
}

.navbar-logo {
    max-height: 38px;
    background-color: #fff;
    padding: 2px;
    border-radius: 4px;
}

.qms-nav-user {
    font-size: 0.85rem;
}

/* ── Cards ── */
.card {
    border-radius: 10px;
    border: 1px solid #e6eaee;
    box-shadow: none;
    background: var(--qms-surface);
}

.card-header.qms-card-header {
    background: var(--qms-brand) !important;
    color: #fff !important;
    border-bottom: none;
    padding: 0.65rem 1rem;
}

.dashboard-card {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    border-radius: 10px;
}

.dashboard-card:hover {
    border-color: var(--qms-accent);
    box-shadow: 0 2px 8px rgba(11, 61, 46, 0.08);
}

.stat-card,
.kpi-link {
    border-radius: 10px;
    border: 1px solid #e6eaee;
    transition: border-color 0.15s ease;
}

.kpi-link:hover {
    border-color: var(--qms-accent);
}

/* ── Buttons ── */
.btn-primary {
    background-color: var(--qms-brand);
    border-color: var(--qms-brand);
    min-height: var(--qms-touch);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--qms-brand-light);
    border-color: var(--qms-brand-light);
}

.btn-success {
    min-height: var(--qms-touch);
}

.btn,
.form-control,
.form-select {
    font-size: 0.95rem;
}

/* ── Form sayfası ── */
.qms-form-header {
    border-left: 4px solid var(--qms-accent);
}

.qms-form-meta-bar {
    background: #fff;
    border: 1px solid #e6eaee;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    z-index: 102;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.qms-matrix-table td {
    vertical-align: middle;
}

.qms-matrix-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

/* +/- toggle */
.qms-toggle-group {
    display: flex;
    gap: 0.35rem;
    width: 100%;
}

.qms-toggle-btn {
    flex: 1;
    min-height: var(--qms-touch);
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.12s ease;
    padding: 0.35rem 0.5rem;
}

.qms-toggle-btn:hover {
    border-color: var(--qms-brand);
}

.qms-toggle-btn.active-pos {
    background: #e8f5ee;
    border-color: var(--qms-success);
    color: var(--qms-success);
}

.qms-toggle-btn.active-neg {
    background: #fdecea;
    border-color: var(--qms-danger);
    color: var(--qms-danger);
}

.qms-toggle-btn.active-neutral {
    background: #eef4ff;
    border-color: #3d6cb9;
    color: #3d6cb9;
}

/* Sticky kaydet */
.qms-sticky-save {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.97);
    border-top: 2px solid var(--qms-brand);
    padding: 0.65rem 1rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

.qms-sticky-save .btn {
    min-width: 140px;
    font-weight: 700;
}

body.qms-has-sticky-save {
    padding-bottom: 72px;
}

/* Kayıt banner */
.qms-save-banner {
    border-left: 4px solid var(--qms-success);
    background: #e8f5ee;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.qms-save-banner .qms-save-actions .btn {
    min-height: 38px;
}

/* Dashboard sekmeler */
.dash-tabs-main .nav-link {
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.55rem 1rem;
    white-space: nowrap;
    color: var(--qms-brand);
    border-radius: 8px;
}

.dash-tabs-main .nav-link.active {
    background: var(--qms-brand);
    color: #fff;
}

.dash-tabs-sub .nav-link {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.65rem;
    white-space: nowrap;
}

.dash-tabs-sub .nav-link.active {
    background: var(--qms-accent);
    color: #1a1d21;
    border-color: var(--qms-accent);
}

.dash-tab-scroll {
    overflow-x: auto;
    flex-wrap: nowrap;
}

.dash-kys-search {
    max-width: 280px;
}

/* Login */
.qms-login-page {
    background: linear-gradient(135deg, var(--qms-brand) 0%, #062a1f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
}

.qms-login-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.qms-login-card .btn-primary {
    font-weight: 700;
}

/* Readonly */
.qms-readonly form[method="POST"] button[type="submit"],
.qms-readonly form[method="POST"] input:not([type="hidden"]),
.qms-readonly form[method="POST"] select,
.qms-readonly form[method="POST"] textarea,
.qms-readonly .qms-toggle-btn,
.qms-readonly .qms-sticky-save {
    pointer-events: none;
    opacity: 0.55;
}

/* Misc */
.pdf-viewer {
    width: 100%;
    min-height: 75vh;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    background: #fff;
}

.form-ham-card:hover {
    border-color: var(--qms-accent);
}

.rev-gecmis-item {
    border-left: 3px solid var(--qms-accent);
    padding-left: 12px;
    margin-bottom: 8px;
}

.formlar-shortcut-card {
    border: 2px solid var(--qms-accent) !important;
    background: #fffef8;
}

.text-qms-brand {
    color: var(--qms-brand) !important;
}

.table-n th,
.table-n td {
    text-align: center;
    vertical-align: middle;
    padding: 4px;
}

.autocomplete-suggestions,
.custom-dropdown {
    position: absolute;
    border: 1px solid #ced4da;
    z-index: 9999;
    background: #fff;
    max-height: 200px;
    overflow-y: auto;
}

.custom-dropdown {
    display: none;
    top: 100%;
    left: 0;
    right: 0;
    border-radius: 0 0 6px 6px;
}

.custom-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f1f1f1;
}

.autocomplete-suggestion {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f1f1f1;
}

.autocomplete-suggestion:hover,
.custom-dropdown-item:hover {
    background-color: #e9ecef;
}

.autocomplete-suggestion.active,
.custom-dropdown-item.active {
    background-color: #0d6efd;
    color: #fff;
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .table-responsive .table-sticky-first th:first-child,
    .table-responsive .table-sticky-first td:first-child {
        position: sticky;
        left: 0;
        background: #fff;
        z-index: 1;
    }

    .dash-tabs-main .nav-link,
    .dash-tabs-sub .nav-link {
        font-size: 0.72rem;
    }

    .qms-form-meta-bar {
        position: relative;
        top: auto;
    }
}
