/* =========================
   MODAL ROOT
========================= */

.modal{
    position:fixed;
    inset:0;

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

    padding:24px;

    z-index:9999;

    visibility:hidden;
    opacity:0;

    pointer-events:none;

    transition:
        opacity .20s ease,
        visibility .20s ease;
}

.modal.show{
    visibility:visible;
    opacity:1;

    pointer-events:auto;
}


/* =========================
   MODAL BACKDROP
========================= */

.modal-backdrop{
    position:absolute;
    inset:0;

    background:rgba(15,23,42,.48);

    backdrop-filter:blur(5px);

    cursor:pointer;
}


/* =========================
   MODAL CARD
========================= */

.modal-card{
    width:100%;
    max-width:560px;
    max-height:calc(100vh - 48px);

    position:relative;
    z-index:2;

    display:flex;
    flex-direction:column;

    border:1px solid rgba(255,255,255,.88);
    border-radius:24px;

    background:rgba(255,255,255,.98);

    box-shadow:
        0 30px 80px rgba(15,23,42,.28),
        0 8px 28px rgba(15,23,42,.15);

    overflow:hidden;

    transform:
        translateY(18px)
        scale(.97);

    transition:
        transform .22s ease;
}

.modal.show .modal-card{
    transform:
        translateY(0)
        scale(1);
}


/* =========================
   MODAL SIZES
========================= */

.modal-card.modal-small{
    max-width:420px;
}

.modal-card.modal-medium{
    max-width:560px;
}

.modal-card.modal-large{
    max-width:780px;
}

.modal-card.modal-xlarge{
    max-width:980px;
}


/* =========================
   MODAL HEADER
========================= */

.modal-header{
    min-height:86px;

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

    padding:20px 22px;

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

    background:
        linear-gradient(
            135deg,
            #ffffff,
            #f7fbf8
        );
}

.modal-header-content{
    min-width:0;
}

.modal-header small{
    display:block;

    margin-bottom:4px;

    color:var(--primary-dark);

    font-size:11px;
    font-weight:800;
    letter-spacing:.7px;
}

.modal-title{
    color:var(--text);

    font-size:21px;
    line-height:1.25;
    font-weight:800;
}

.modal-subtitle{
    margin-top:5px;

    color:var(--muted);

    font-size:13px;
    line-height:1.45;
}


/* =========================
   MODAL CLOSE
========================= */

.modal-close{
    width:42px;
    height:42px;
    flex-shrink:0;

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

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

    background:#f8fbf9;

    color:#526159;

    cursor:pointer;

    font-size:25px;
    line-height:1;

    transition:
        background .18s ease,
        color .18s ease,
        border-color .18s ease,
        transform .18s ease;
}

.modal-close:hover{
    border-color:#fecaca;

    background:var(--danger-bg);

    color:var(--danger);

    transform:rotate(4deg);
}


/* =========================
   MODAL BODY
========================= */

.modal-body{
    flex:1;

    padding:22px;

    overflow-y:auto;
}

.modal-body.no-padding{
    padding:0;
}

.modal-description{
    margin-bottom:18px;

    color:var(--muted);

    font-size:14px;
    line-height:1.55;
}


/* =========================
   MODAL FOOTER
========================= */

.modal-footer{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:10px;

    padding:16px 22px;

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

    background:#f8fbf9;
}


/* =========================
   MODAL GRID
========================= */

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

    gap:14px;
}

.modal-grid.three-column{
    grid-template-columns:
        repeat(3,minmax(0,1fr));
}


/* =========================
   MODAL OPTION BUTTON
========================= */

.modal-option{
    min-height:130px;

    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:7px;

    padding:18px;

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

    background:
        linear-gradient(
            145deg,
            #ffffff,
            #f7faf8
        );

    color:var(--text);

    cursor:pointer;

    text-align:center;

    box-shadow:
        0 6px 16px rgba(30,72,51,.06);

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

.modal-option:hover{
    transform:translateY(-3px);

    border-color:#86efac;

    background:#f0fdf4;

    box-shadow:
        0 14px 26px rgba(22,163,74,.14);
}

.modal-option:active{
    transform:scale(.98);
}

.modal-option-icon{
    width:54px;
    height:54px;

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

    border-radius:16px;

    background:var(--primary-light);

    font-size:27px;
}

.modal-option strong{
    font-size:15px;
    font-weight:800;
}

.modal-option small{
    color:var(--muted);

    font-size:12px;
    line-height:1.4;
}


/* =========================
   OPTION VARIANTS
========================= */

.modal-option.success{
    border-color:#bbf7d0;

    background:#f0fdf4;
}

.modal-option.warning{
    border-color:#fde68a;

    background:#fffbeb;
}

.modal-option.danger{
    border-color:#fecaca;

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

.modal-option.info{
    border-color:#bfdbfe;

    background:#eff6ff;
}


/* =========================
   MODAL ACTION BUTTONS
========================= */

.modal-actions{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:10px;

    width:100%;
}

.modal-btn{
    min-width:120px;
    min-height:46px;

    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;

    padding:0 18px;

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

    background:#fff;

    color:var(--text);

    cursor:pointer;

    font-size:14px;
    font-weight:750;

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

.modal-btn:hover{
    transform:translateY(-1px);

    border-color:#a7b5ad;

    background:#f8fbf9;
}

.modal-btn.primary{
    border-color:transparent;

    background:
        linear-gradient(
            135deg,
            #22c55e,
            #15803d
        );

    color:#fff;

    box-shadow:
        0 10px 20px rgba(22,163,74,.20);
}

.modal-btn.warning{
    border-color:transparent;

    background:
        linear-gradient(
            135deg,
            #f59e0b,
            #ea580c
        );

    color:#fff;

    box-shadow:
        0 10px 20px rgba(245,158,11,.20);
}

.modal-btn.danger{
    border-color:#fecaca;

    background:var(--danger-bg);

    color:var(--danger);
}


/* =========================
   MODAL FORM
========================= */

.modal-form-group{
    margin-bottom:17px;
}

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

.modal-form-group label{
    display:block;

    margin:0 0 7px 3px;

    color:#34473d;

    font-size:13px;
    font-weight:700;
}

.modal-input,
.modal-select,
.modal-textarea{
    width:100%;

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

    outline:none;

    background:#fbfdfc;

    color:var(--text);

    font-size:14px;

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

.modal-input,
.modal-select{
    height:52px;

    padding:0 15px;
}

.modal-textarea{
    min-height:110px;

    padding:13px 15px;

    resize:vertical;
}

.modal-input:focus,
.modal-select:focus,
.modal-textarea:focus{
    border-color:#4ade80;

    background:#fff;

    box-shadow:
        0 0 0 4px rgba(34,197,94,.11);
}


/* =========================
   MODAL INFO BOX
========================= */

.modal-info{
    display:flex;
    align-items:flex-start;
    gap:11px;

    padding:14px;

    border:1px solid #bbf7d0;
    border-radius:14px;

    background:#f0fdf4;

    color:#166534;

    font-size:13px;
    line-height:1.5;
}

.modal-info.warning{
    border-color:#fde68a;

    background:#fffbeb;

    color:#92400e;
}

.modal-info.danger{
    border-color:#fecaca;

    background:var(--danger-bg);

    color:var(--danger);
}


/* =========================
   MODAL AMOUNT
========================= */

.modal-amount{
    padding:17px;

    border-radius:16px;

    background:
        linear-gradient(
            135deg,
            #22c55e,
            #15803d
        );

    color:#fff;

    text-align:center;

    box-shadow:
        0 12px 24px rgba(22,163,74,.20);
}

.modal-amount small{
    display:block;

    opacity:.82;

    font-size:11px;
    font-weight:800;
    letter-spacing:.7px;
}

.modal-amount strong{
    display:block;

    margin-top:5px;

    font-size:30px;
    line-height:1.2;
}


/* =========================
   MODAL LOADING
========================= */

.modal-loading{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;

    min-height:220px;

    text-align:center;
}

.modal-spinner{
    width:48px;
    height:48px;

    border:5px solid var(--primary-light);
    border-top-color:var(--primary);

    border-radius:50%;

    animation:modalSpin .75s linear infinite;
}

.modal-loading strong{
    margin-top:17px;

    font-size:17px;
}

.modal-loading small{
    margin-top:6px;

    color:var(--muted);

    font-size:13px;
}

@keyframes modalSpin{
    to{
        transform:rotate(360deg);
    }
}


/* =========================
   MOBILE
========================= */

@media(max-width:650px){

    .modal{
        align-items:flex-end;

        padding:12px;
    }

    .modal-card,
    .modal-card.modal-small,
    .modal-card.modal-medium,
    .modal-card.modal-large,
    .modal-card.modal-xlarge{
        max-width:100%;
        max-height:calc(100vh - 24px);

        border-radius:22px 22px 16px 16px;
    }

    .modal-header{
        min-height:76px;

        padding:17px;
    }

    .modal-title{
        font-size:19px;
    }

    .modal-body{
        padding:17px;
    }

    .modal-footer{
        padding:14px 17px;
    }

    .modal-grid,
    .modal-grid.three-column{
        grid-template-columns:1fr;
    }

    .modal-option{
        min-height:100px;

        flex-direction:row;
        justify-content:flex-start;

        text-align:left;
    }

    .modal-option-icon{
        flex-shrink:0;
    }

    .modal-actions{
        flex-direction:column-reverse;
    }

    .modal-btn{
        width:100%;
    }
}

/* =========================
   ÜRÜN GÖRSEL ÖNİZLEME
========================= */

.product-image-preview-box {
    width: 100%;
    min-height: 190px;

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

    overflow: hidden;

    border: 1px dashed rgba(148, 163, 184, 0.65);
    border-radius: 16px;

    background:
        rgba(248, 250, 252, 0.85);
}

.product-image-preview-box img {
    display: block;

    width: 100%;
    height: 220px;

    object-fit: contain;

    padding: 12px;
}

.product-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 10px;

    padding: 30px;

    color: #64748b;

    font-size: 34px;
    text-align: center;
}

.product-image-placeholder span {
    font-size: 14px;
    font-weight: 600;
}

/* =========================
   ÜRÜN İKON SEÇİCİ
========================= */

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

.product-icon-picker {
    width: 100%;
    min-height: 180px;
    max-height: 360px;

    display: grid;
    grid-template-columns:
        repeat(
            auto-fill,
            minmax(125px, 1fr)
        );

    gap: 12px;

    padding: 14px;

    overflow-y: auto;

    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 16px;

    background: rgba(248, 250, 252, 0.75);
}

.product-icon-empty {
    grid-column: 1 / -1;

    min-height: 150px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 7px;

    color: #64748b;
    text-align: center;
}

.product-icon-empty-symbol {
    font-size: 34px;
}

.product-icon-empty strong {
    color: #334155;
    font-size: 15px;
}

.product-icon-empty small {
    max-width: 360px;
    line-height: 1.5;
}

.product-icon-option {
    position: relative;

    min-height: 135px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 8px;

    padding: 12px;

    border: 2px solid transparent;
    border-radius: 15px;

    background: #ffffff;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.product-icon-option:hover {
    transform: translateY(-2px);

    border-color: rgba(79, 70, 229, 0.35);

    box-shadow:
        0 12px 24px
        rgba(15, 23, 42, 0.08);
}

.product-icon-option.selected {
    border-color: #4f46e5;

    box-shadow:
        0 0 0 3px
        rgba(79, 70, 229, 0.12);
}

.product-icon-option img {
    width: 72px;
    height: 72px;

    object-fit: contain;
}

.product-icon-option strong {
    max-width: 100%;

    overflow: hidden;

    color: #334155;

    font-size: 13px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-icon-option small {
    color: #94a3b8;
    font-size: 11px;
}

.product-icon-option-check {
    position: absolute;

    top: 8px;
    right: 8px;

    width: 23px;
    height: 23px;

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

    border-radius: 50%;

    background: #4f46e5;
    color: #ffffff;

    font-size: 13px;
    font-weight: 700;
}

.product-icon-option.selected
.product-icon-option-check {
    display: flex;
}


/* =========================
   SEÇİLEN ÜRÜN İKONU
========================= */

.selected-product-icon-box {
    min-height: 120px;

    display: flex;
    align-items: center;

    gap: 16px;

    padding: 16px;

    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 16px;

    background: rgba(248, 250, 252, 0.8);
}

.selected-product-icon-box img {
    width: 84px;
    height: 84px;

    flex: 0 0 auto;

    object-fit: contain;

    padding: 7px;

    border-radius: 14px;

    background: #ffffff;
}

.selected-product-icon-placeholder {
    width: 100%;

    color: #94a3b8;

    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.selected-product-icon-info {
    display: flex;
    flex-direction: column;

    gap: 5px;
}

.selected-product-icon-info strong {
    color: #1e293b;
    font-size: 15px;
}

.selected-product-icon-info small {
    color: #64748b;
    font-size: 13px;
}

/* =========================
   STOK HAREKET MODALI
========================= */

.stock-barcode-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.stock-selected-product {
    min-height: 112px;

    display: flex;
    align-items: center;

    gap: 15px;

    padding: 16px;

    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 16px;

    background: rgba(248, 250, 252, 0.78);
}

.stock-selected-product-empty {
    width: 100%;

    color: #94a3b8;

    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.stock-selected-product > img {
    width: 74px;
    height: 74px;

    flex: 0 0 74px;

    padding: 5px;

    object-fit: contain;

    border-radius: 14px;

    background: #ffffff;
}

.stock-selected-product-info {
    min-width: 0;

    display: flex;
    flex: 1;
    flex-direction: column;

    gap: 5px;
}

.stock-selected-product-info strong {
    color: #1e293b;
    font-size: 16px;
}

.stock-selected-product-info span {
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.stock-selected-product-info small {
    color: #94a3b8;
    font-size: 12px;
}

.stock-selected-product-balance {
    min-width: 130px;

    display: flex;
    flex-direction: column;
    align-items: flex-end;

    gap: 3px;
}

.stock-selected-product-balance small {
    color: #64748b;
    font-size: 12px;
}

.stock-selected-product-balance strong {
    color: #0f172a;
    font-size: 25px;
    line-height: 1;
}

.stock-selected-product-balance span {
    color: #64748b;
    font-size: 12px;
}


/* =========================
   STOK ÖNİZLEME
========================= */

.stock-preview-box {
    display: grid;
    grid-template-columns:
        minmax(120px, 1fr)
        auto
        minmax(120px, 1fr)
        auto;

    align-items: center;

    gap: 14px;

    padding: 18px;

    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 16px;

    background: rgba(248, 250, 252, 0.78);
}

.stock-preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 5px;
}

.stock-preview-item small {
    color: #64748b;
    font-size: 12px;
}

.stock-preview-item strong {
    color: #0f172a;
    font-size: 26px;
}

.stock-preview-arrow {
    color: #94a3b8;
    font-size: 25px;
    font-weight: 700;
}

.stock-preview-difference {
    min-width: 70px;

    padding: 8px 12px;

    border-radius: 999px;

    background: #e2e8f0;
    color: #475569;

    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.stock-preview-difference.positive {
    background: #dcfce7;
    color: #15803d;
}

.stock-preview-difference.negative {
    background: #fee2e2;
    color: #b91c1c;
}


/* =========================
   STOK SAYFASI FİLTRELERİ
========================= */

.stock-filter-card {
    margin-bottom: 20px;
}

.stock-filter-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 16px;

    padding: 18px;
}

.stock-filter-action {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}


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

@media (max-width: 900px) {

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

    .stock-preview-box {
        grid-template-columns:
            1fr auto 1fr;
    }

    .stock-preview-difference {
        grid-column: 1 / -1;
        justify-self: center;
    }

}

@media (max-width: 600px) {

    .stock-barcode-search-row {
        grid-template-columns: 1fr;
    }

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

    .stock-selected-product {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .stock-selected-product-balance {
        width: 100%;
        align-items: flex-start;
    }

}

/* =========================
   STOK GEÇMİŞİ MODALI
========================= */

.stock-history-product {
    min-height: 110px;

    display: flex;
    align-items: center;

    gap: 15px;

    margin-bottom: 18px;
    padding: 16px;

    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 16px;

    background: rgba(248, 250, 252, 0.78);
}

.stock-history-product-empty {
    width: 100%;

    color: #94a3b8;

    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.stock-history-product > img {
    width: 72px;
    height: 72px;

    flex: 0 0 72px;

    padding: 5px;

    object-fit: contain;

    border-radius: 14px;

    background: #ffffff;
}

.stock-history-product-info {
    min-width: 0;

    display: flex;
    flex: 1;
    flex-direction: column;

    gap: 5px;
}

.stock-history-product-info strong {
    color: #1e293b;
    font-size: 16px;
}

.stock-history-product-info span {
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.stock-history-product-info small {
    color: #94a3b8;
    font-size: 12px;
}

.stock-history-product-balance {
    min-width: 130px;

    display: flex;
    flex-direction: column;
    align-items: flex-end;

    gap: 3px;
}

.stock-history-product-balance small {
    color: #64748b;
    font-size: 12px;
}

.stock-history-product-balance strong {
    color: #0f172a;
    font-size: 26px;
    line-height: 1;
}

.stock-history-product-balance span {
    color: #64748b;
    font-size: 12px;
}


/* =========================
   STOK GEÇMİŞİ ÖZETLERİ
========================= */

.stock-history-summary-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 12px;

    margin-bottom: 18px;
}

.stock-history-summary-card {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 5px;

    padding: 15px;

    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 14px;

    background: #ffffff;
}

.stock-history-summary-card small {
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.stock-history-summary-card strong {
    overflow: hidden;

    color: #0f172a;

    font-size: 21px;
    line-height: 1.2;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-history-summary-card span {
    color: #94a3b8;
    font-size: 11px;
}

.stock-history-summary-card
.stock-history-last-date {
    font-size: 14px;
}


/* =========================
   STOK GEÇMİŞİ FİLTRELERİ
========================= */

.stock-history-filter-grid {
    display: grid;
    grid-template-columns:
        minmax(180px, 1fr)
        minmax(150px, 1fr)
        minmax(150px, 1fr)
        auto;

    align-items: end;

    gap: 12px;

    margin-bottom: 18px;
    padding: 15px;

    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;

    background: rgba(248, 250, 252, 0.7);
}

.stock-history-filter-action {
    min-width: 100px;
}


/* =========================
   STOK GEÇMİŞİ TABLOSU
========================= */

.stock-history-table-wrap {
    width: 100%;
    max-height: 430px;

    overflow: auto;

    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
}

.stock-history-table {
    min-width: 1180px;
}

.stock-history-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;

    background: #f8fafc;
}

.stock-history-table td {
    vertical-align: middle;
}

.stock-history-movement-badge {
    display: inline-flex;
    align-items: center;

    gap: 5px;

    padding: 6px 9px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.stock-history-movement-badge.increase {
    background: #dcfce7;
    color: #15803d;
}

.stock-history-movement-badge.decrease {
    background: #fee2e2;
    color: #b91c1c;
}

.stock-history-movement-badge.neutral {
    background: #e2e8f0;
    color: #475569;
}

.stock-history-quantity {
    font-weight: 700;
    white-space: nowrap;
}

.stock-history-quantity.increase {
    color: #15803d;
}

.stock-history-quantity.decrease {
    color: #b91c1c;
}

.stock-history-note {
    display: block;

    max-width: 220px;

    overflow: hidden;

    color: #64748b;

    font-size: 12px;
    line-height: 1.4;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-history-source {
    display: inline-block;

    padding: 5px 8px;

    border-radius: 8px;

    background: #f1f5f9;
    color: #475569;

    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}


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

@media (max-width: 1000px) {

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

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

}

@media (max-width: 600px) {

    .stock-history-product {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .stock-history-product-balance {
        width: 100%;
        align-items: flex-start;
    }

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

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

}