/* =========================================================
   IT ENVANTER YÖNETİM SİSTEMİ
   CORPORATE UI DESIGN SYSTEM
   ========================================================= */

:root {
    --sidebar: #142a47;
    --sidebar-dark: #0f2038;
    --sidebar-hover: #1e3a60;
    --sidebar-active: #29496f;

    --primary: #2563a6;
    --primary-dark: #1d4f87;
    --primary-light: #eaf2fb;

    --success: #23834b;
    --success-bg: #e9f7ef;

    --warning: #a36b00;
    --warning-bg: #fff5dc;

    --danger: #b42323;
    --danger-bg: #fdecec;

    --info: #2563a6;
    --info-bg: #eaf2fb;

    --text: #1d2b3c;
    --text-dark: #14243a;
    --text-muted: #718096;

    --border: #dfe5ec;
    --border-light: #edf1f5;

    --background: #f4f6f9;
    --white: #ffffff;

    --radius: 10px;
    --radius-lg: 14px;

    --shadow: 0 2px 8px rgba(20, 42, 71, 0.05);
    --shadow-hover: 0 5px 18px rgba(20, 42, 71, 0.09);
}


/* =========================================================
   RESET
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    margin: 0;
    padding: 0;

    background: var(--background);

    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    line-height: 1.5;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}


/* =========================================================
   APP LAYOUT
   ========================================================= */

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


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
    width: 245px;

    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;

    background: var(--sidebar);

    color: #fff;

    display: flex;
    flex-direction: column;

    z-index: 100;
}


/* BRAND */

.brand {
    height: 74px;

    display: flex;
    align-items: center;

    padding: 0 22px;

    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .05em;
}

.brand-subtitle {
    font-size: 11px;

    color: #aebdd0;

    margin-top: 2px;
}


/* NAV */

.sidebar nav {
    padding: 18px 12px;
}

.sidebar nav a {
    display: flex;
    align-items: center;

    min-height: 43px;

    padding: 0 13px;

    margin-bottom: 4px;

    border-radius: 8px;

    color: #d8e1ec;

    text-decoration: none;

    font-size: 13px;
    font-weight: 500;

    transition:
        background .15s ease,
        color .15s ease;
}

.sidebar nav a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar nav a.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 700;
}


/* =========================================================
   MAIN
   ========================================================= */

.main {
    margin-left: 245px;

    width: calc(100% - 245px);

    min-width: 0;
}


/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
    min-height: 74px;

    background: #fff;

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 30px;

    position: sticky;
    top: 0;

    z-index: 50;
}

.topbar h1 {
    margin: 0;

    color: var(--text-dark);

    font-size: 22px;

    font-weight: 750;
}

.topbar .muted {
    margin-top: 2px;

    color: var(--text-muted);

    font-size: 12px;
}


/* =========================================================
   CONTENT
   ========================================================= */

.content {
    padding: 28px 30px 50px;

    max-width: 1600px;

    margin: 0 auto;
}


/* =========================================================
   PANEL
   ========================================================= */

.panel {
    background: var(--white);

    border: 1px solid var(--border);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow);

    overflow: hidden;
}

.panel + .panel {
    margin-top: 20px;
}

.panel-header {
    min-height: 66px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 16px 22px;

    border-bottom: 1px solid var(--border-light);
}

.panel-header h2 {
    margin: 0;

    color: var(--text-dark);

    font-size: 16px;

    font-weight: 750;
}

.panel-header .muted {
    display: block;

    margin-top: 3px;

    color: var(--text-muted);

    font-size: 12px;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 6px;

    min-height: 38px;

    padding: 0 14px;

    border-radius: 7px;

    border: 1px solid transparent;

    text-decoration: none;

    cursor: pointer;

    font-size: 13px;
    font-weight: 650;

    transition:
        background .15s ease,
        border-color .15s ease,
        box-shadow .15s ease,
        transform .05s ease;
}

.btn:active {
    transform: translateY(1px);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #344b68;
    color: #fff;
}

.btn-secondary:hover {
    background: #263d58;
}

.btn-light {
    background: #fff;

    color: #40536a;

    border-color: var(--border);
}

.btn-light:hover {
    background: #f7f9fb;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
}


/* =========================================================
   DASHBOARD / STAT CARDS
   ========================================================= */

.stats {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 16px;

    margin-bottom: 20px;
}

.stat-card {
    background: #fff;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    padding: 19px 20px;

    box-shadow: var(--shadow);

    transition:
        box-shadow .15s ease,
        transform .15s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-hover);

    transform: translateY(-1px);
}

.stat-label {
    color: var(--text-muted);

    font-size: 11px;

    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: .04em;
}

.stat-value {
    color: var(--text-dark);

    font-size: 27px;

    font-weight: 800;

    margin-top: 6px;
}


/* =========================================================
   TABLES
   ========================================================= */

.table-wrapper {
    width: 100%;

    overflow-x: auto;
}

table {
    width: 100%;

    border-collapse: collapse;

    background: #fff;
}

thead th {
    background: #f8fafc;

    color: #718096;

    border-bottom: 1px solid var(--border);

    padding: 12px 15px;

    text-align: left;

    font-size: 11px;

    font-weight: 750;

    text-transform: uppercase;

    letter-spacing: .035em;

    white-space: nowrap;
}

tbody td {
    padding: 14px 15px;

    border-bottom: 1px solid var(--border-light);

    color: #33445a;

    font-size: 13px;

    vertical-align: middle;
}

tbody tr {
    transition: background .12s ease;
}

tbody tr:hover {
    background: #f8fafc;
}

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


/* =========================================================
   SEARCH / FILTER
   ========================================================= */

.filter-form {
    display: grid;

    grid-template-columns:
        minmax(250px, 2fr)
        minmax(160px, 1fr)
        minmax(160px, 1fr)
        auto
        auto;

    gap: 10px;

    padding: 18px 22px;

    background: #fafbfd;

    border-bottom: 1px solid var(--border-light);
}

.filter-form input,
.filter-form select {
    width: 100%;
}


/* =========================================================
   FORMS
   ========================================================= */

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px 20px;

    padding: 24px;
}

.form-group {
    display: flex;

    flex-direction: column;

    gap: 7px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group label {
    color: #44566d;

    font-size: 12px;

    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;

    min-height: 40px;

    padding: 9px 11px;

    background: #fff;

    color: var(--text);

    border: 1px solid #d7dfe8;

    border-radius: 7px;

    outline: none;

    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

textarea {
    min-height: 110px;

    resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #bcc8d5;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(37,99,166,.10);
}

.form-actions {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: 10px;

    padding: 18px 24px;

    border-top: 1px solid var(--border-light);

    background: #fafbfd;
}


/* =========================================================
   BADGES
   ========================================================= */

.badge {
    display: inline-flex;

    align-items: center;

    gap: 6px;

    padding: 5px 9px;

    border-radius: 999px;

    font-size: 11px;

    font-weight: 750;

    white-space: nowrap;
}

.badge-success {
    color: var(--success);
    background: var(--success-bg);
}

.badge-warning {
    color: var(--warning);
    background: var(--warning-bg);
}

.badge-danger {
    color: var(--danger);
    background: var(--danger-bg);
}

.badge-secondary {
    color: #66758a;
    background: #edf1f5;
}

.badge-info {
    color: var(--info);
    background: var(--info-bg);
}


/* =========================================================
   ALERTS
   ========================================================= */

.alert {
    padding: 13px 15px;

    margin-bottom: 18px;

    border-radius: 8px;

    border: 1px solid transparent;

    font-size: 13px;
}

.alert ul {
    margin: 0;
    padding-left: 18px;
}

.alert-success {
    color: #1f7041;
    background: #ebf8f0;
    border-color: #ccebd8;
}

.alert-danger {
    color: #9c2525;
    background: #fdf0f0;
    border-color: #f2cccc;
}

.alert-warning {
    color: #805c00;
    background: #fff8e5;
    border-color: #f2dfad;
}


/* =========================================================
   PAGINATION
   ========================================================= */

.pagination {
    display: flex;

    gap: 5px;

    padding: 18px 22px;

    border-top: 1px solid var(--border-light);
}

.pagination a {
    min-width: 34px;
    height: 34px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);

    border-radius: 6px;

    background: #fff;

    color: #53657b;

    text-decoration: none;

    font-size: 12px;

    font-weight: 650;
}

.pagination a:hover {
    background: #f4f7fa;
}

.pagination a.active {
    background: var(--primary);

    border-color: var(--primary);

    color: #fff;
}


/* =========================================================
   EMPTY STATES
   ========================================================= */

.empty-state {
    padding: 45px 20px !important;

    text-align: center;

    color: #8a96a8;

    font-size: 13px;
}


/* =========================================================
   DETAIL GRID
   ========================================================= */

.detail-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;

    padding: 24px;
}

.detail-grid > div {
    display: flex;

    flex-direction: column;

    gap: 5px;
}

.detail-grid strong {
    color: #8793a5;

    font-size: 11px;

    font-weight: 750;

    text-transform: uppercase;
}

.detail-grid span {
    color: #293b52;

    font-size: 14px;
}

.detail-full {
    grid-column: 1 / -1;
}


/* =========================================================
   LOGIN
   ========================================================= */

.login-page {
    min-height: 100vh;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 25px;

    background:
        linear-gradient(
            135deg,
            #edf2f8 0%,
            #f7f9fb 100%
        );
}

.login-card {
    width: 100%;

    max-width: 430px;

    background: #fff;

    border: 1px solid var(--border);

    border-radius: 14px;

    box-shadow:
        0 15px 45px rgba(20,42,71,.10);

    padding: 35px;
}

.login-logo {
    text-align: center;

    margin-bottom: 28px;
}


/* =========================================================
   PERSONNEL CORPORATE HEADER
   ========================================================= */

.personnel-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 22px;
}

.personnel-header-left {
    display: flex;

    align-items: center;

    gap: 15px;
}

.personnel-avatar {
    width: 56px;
    height: 56px;

    border-radius: 12px;

    background: var(--primary-light);

    color: var(--primary);

    display: flex;

    align-items: center;
    justify-content: center;

    font-size: 19px;

    font-weight: 800;
}

.personnel-name {
    margin: 0;

    color: var(--text-dark);

    font-size: 23px;

    font-weight: 800;
}

.personnel-meta {
    margin: 4px 0 0;

    color: var(--text-muted);

    font-size: 12px;
}

.personnel-actions {
    display: flex;

    align-items: center;

    gap: 8px;
}

.personnel-status {
    display: inline-flex;

    align-items: center;

    gap: 6px;

    padding: 6px 10px;

    border-radius: 999px;

    font-size: 11px;

    font-weight: 750;
}

.personnel-status::before {
    content: "";

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: currentColor;
}

.personnel-status.active {
    color: var(--success);

    background: var(--success-bg);
}

.personnel-status.on-leave {
    color: var(--warning);

    background: var(--warning-bg);
}

.personnel-status.terminated {
    color: var(--danger);

    background: var(--danger-bg);
}


/* =========================================================
   PERSONNEL SUMMARY
   ========================================================= */

.personnel-summary {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 14px;

    margin-bottom: 20px;
}

.personnel-summary-card {
    background: #fff;

    border: 1px solid var(--border);

    border-radius: 10px;

    padding: 16px 18px;
}

.personnel-summary-label {
    color: #8793a5;

    font-size: 10px;

    font-weight: 750;

    text-transform: uppercase;

    letter-spacing: .04em;
}

.personnel-summary-value {
    color: var(--text-dark);

    font-size: 18px;

    font-weight: 800;

    margin-top: 5px;
}


/* =========================================================
   PERSONNEL DETAIL
   ========================================================= */

.personnel-detail-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;
}

.personnel-detail-card {
    background: #fff;

    border: 1px solid var(--border);

    border-radius: 11px;

    overflow: hidden;

    box-shadow: var(--shadow);
}

.personnel-detail-card-header {
    padding: 14px 18px;

    background: #fafbfd;

    border-bottom: 1px solid var(--border-light);
}

.personnel-detail-card-header h3 {
    margin: 0;

    color: var(--text-dark);

    font-size: 14px;
}

.personnel-detail-body {
    padding: 18px;
}

.personnel-field {
    display: flex;

    flex-direction: column;

    gap: 4px;

    padding: 10px 0;

    border-bottom: 1px solid var(--border-light);
}

.personnel-field:first-child {
    padding-top: 0;
}

.personnel-field:last-child {
    padding-bottom: 0;

    border-bottom: 0;
}

.personnel-field-label {
    color: #8995a7;

    font-size: 10px;

    font-weight: 750;

    letter-spacing: .03em;
}

.personnel-field-value {
    color: #293b52;

    font-size: 13px;

    font-weight: 600;
}

.personnel-field-value a {
    color: var(--primary);

    text-decoration: none;
}

.personnel-field-value a:hover {
    text-decoration: underline;
}


/* =========================================================
   PERSONNEL SECTIONS
   ========================================================= */

.personnel-section-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 15px;

    margin-bottom: 15px;
}

.personnel-section-header h2 {
    margin: 0;

    color: var(--text-dark);

    font-size: 16px;
}

.personnel-section-header p {
    margin: 3px 0 0;

    color: var(--text-muted);

    font-size: 11px;
}

.personnel-device-table th {
    background: #f8fafc;
}

.personnel-device-name {
    color: var(--text-dark);

    font-weight: 700;
}

.personnel-device-sub {
    color: #8995a7;

    font-size: 11px;

    margin-top: 2px;
}

.personnel-empty {
    padding: 35px 20px;

    text-align: center;

    color: #8995a7;

    font-size: 13px;
}

.personnel-empty-icon {
    margin-bottom: 7px;

    font-size: 22px;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {

    .stats {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .filter-form {
        grid-template-columns:
            1fr 1fr;
    }

}

@media (max-width: 800px) {

    .sidebar {
        width: 210px;
    }

    .main {
        margin-left: 210px;

        width: calc(100% - 210px);
    }

    .content {
        padding: 20px;
    }

    .topbar {
        padding: 0 20px;
    }

    .personnel-detail-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 650px) {

    .sidebar {
        width: 100%;

        position: relative;

        min-height: auto;
    }

    .app {
        flex-direction: column;
    }

    .main {
        width: 100%;

        margin-left: 0;
    }

    .topbar {
        position: relative;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .filter-form {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group-full {
        grid-column: auto;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-full {
        grid-column: auto;
    }

    .personnel-summary {
        grid-template-columns: 1fr;
    }

    .personnel-header {
        align-items: flex-start;

        flex-direction: column;
    }

    .personnel-actions {
        width: 100%;
    }

}

/* =========================================================
   INVENTORY FORM
   ========================================================= */

.inventory-form-section {
    border-top: 1px solid var(--border-light);
}

.inventory-form-section:first-child {
    border-top: 0;
}

.inventory-form-section .panel-header {
    background: #fafbfd;
}

.inventory-form-section .panel-header h2 {
    font-size: 15px;
}

.inventory-form-help {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 3px;
}

.inventory-status-preview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* =========================================================
   CİHAZ DETAY SAYFASI
   ========================================================= */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    width: 100%;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
}

.detail-item:nth-child(odd) {
    border-right: 1px solid var(--border-light);
}

.detail-label {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.detail-item strong {
    display: block;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
}

.detail-item .badge {
    width: fit-content;
}


/* Sayfa başlığı */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

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

.breadcrumb a:hover {
    text-decoration: underline;
}


/* Sayfa üst butonları */

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}


/* Boş alan */

.empty-state {
    padding: 28px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state strong {
    display: block;
    color: var(--text-main);
    margin-bottom: 6px;
}

.empty-state p {
    margin: 0;
    font-size: 13px;
}


/* Not alanı */

.notes-box {
    padding: 16px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.7;
    white-space: normal;
    word-break: break-word;
}


/* Detay sayfasındaki paneller */

.main-content > .panel {
    margin-bottom: 18px;
}

.main-content > .dashboard-grid {
    margin-bottom: 18px;
}

.main-content > .dashboard-grid .panel {
    margin-bottom: 0;
}


/* Tablo */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
}

.data-table td {
    color: var(--text-main);
    font-size: 13px;
}

.data-table tbody tr:hover {
    background: #fafbfd;
}

.data-table small {
    color: var(--text-muted);
    font-size: 11px;
}


/* Mobil */

@media (max-width: 768px) {

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-item:nth-child(odd) {
        border-right: 0;
    }

    .detail-item {
        padding: 13px 14px;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .data-table {
        min-width: 650px;
    }

}

/* =========================================================
   VIEW.PHP / INVENTORY DETAIL LAYOUT FIX
   ========================================================= */

.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    margin-left: 245px;
    width: calc(100% - 245px);
    min-width: 0;
    box-sizing: border-box;
}

@media (max-width: 800px) {

    .main-content {
        margin-left: 210px;
        width: calc(100% - 210px);
    }

}

@media (max-width: 650px) {

    .app-shell {
        display: block;
    }

    .main-content {
        width: 100%;
        margin-left: 0;
    }

}