/* ==========================
   IB Pending Monitor
   Version 1.0
========================== */

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

body{

    font-family:'Poppins',sans-serif;

    background:#d9e1ea;

    color:#2e2a27;

}

.layout{

    display:flex;
    min-height:100vh;

}

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

.sidebar{

    flex:0 0 270px;
    width:270px;

    background:#2e2a27;
    color:white;

    display:flex;
    flex-direction:column;

    box-shadow:5px 0 18px rgba(0,0,0,.12);

}

.logo-area{

    text-align:center;

    padding:30px 20px;

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

}

.logo-area img{

    width:190px;

    margin-bottom:15px;

}

.logo-area h2{

    color:#FFD400;

    font-size:22px;

    font-weight:700;

}

.sidebar nav{

    padding:20px;

}

.sidebar nav a{

    display:block;

    color:white;

    text-decoration:none;

    padding:15px 18px;

    margin-bottom:10px;

    border-radius:12px;

    transition:.25s;

    cursor:pointer;

    font-weight:500;

}

.sidebar nav a:hover{

    background:#FFD400;

    color:#2e2a27;

}

.sidebar nav .active{

    background:#FFD400;

    color:#2e2a27;

}

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

main{

    flex:1;
    width:100%;
    min-width:0;

    padding:35px;

}


/* =====================
HEADER
======================*/
header{

    display:flex;

    justify-content:space-between;

    align-items:center;

    margin-bottom:35px;

}

header > div{

    display:flex;

    flex-direction:column;

    gap:8px;

}

header h1{

    font-size:34px;

}

header small{

    color:#666;

}

#refreshBtn{

    background:#FFD400;

    color:#2e2a27;

    border:none;

    border-radius:10px;

    padding:12px 22px;

    cursor:pointer;

    font-size:15px;

    font-weight:600;

    transition:.25s;

}

#refreshBtn:hover{

    transform:translateY(-2px);

    box-shadow:0 8px 20px rgba(255,212,0,.45);

}

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

.cards{

    display:grid;

    grid-template-columns:repeat(auto-fit,minmax(285px,1fr));

    gap:22px;

    width:100%;

}


.card{

    background:#ffffff;

    border:1px solid #e2e8f0;

    border-radius:18px;

    padding:24px;

    box-shadow:
        0 6px 16px rgba(0,0,0,.08),
        0 1px 3px rgba(0,0,0,.05);

    transition:all .25s ease;

}

.card:hover{

    transform:translateY(-4px);

    box-shadow:
        0 12px 28px rgba(0,0,0,.12),
        0 4px 10px rgba(0,0,0,.06);

}

.card h3{

    color:#6b7280;

    font-size:14px;

    font-weight:600;

    margin-bottom:10px;

}

.card h1{

    font-size:40px;

    font-weight:700;

    color:#1f2937;

    letter-spacing:-0.5px;

}
.warning{

    border-left:8px solid #FB8C00;

}

.critical{

    border-left:8px solid #E53935;

}

/* =====================
CHART
======================*/

.chart-area{

    background:white;

    border-radius:20px;

    box-shadow:0 8px 18px rgba(0,0,0,.08);

    min-height:330px;

    padding:25px;

    margin-bottom:30px;

}

/* =====================
TABLE
======================*/

.table-area{

    background:white;

    border-radius:20px;

    box-shadow:0 8px 18px rgba(0,0,0,.08);

    min-height:500px;

    padding:25px;

    margin-top:50px;

}

/* =====================
SCROLLBAR
======================*/

::-webkit-scrollbar{

    width:8px;

}

::-webkit-scrollbar-thumb{

    background:#FFD400;

    border-radius:20px;

}

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

@media(max-width:1100px){

.sidebar{

    width:90px;

}

.logo-area h2{

    display:none;

}

.sidebar nav a{

    text-align:center;

    padding:16px 5px;

    font-size:12px;

}

main{

    padding:20px;

}

}

@media(max-width:768px){

.layout{

    flex-direction:column;

}

.sidebar{

    width:100%;

}

header{

    flex-direction:column;

    align-items:flex-start;

    gap:20px;

}

.cards{

    grid-template-columns:1fr;

}

}

.card{

    display:flex;

    align-items:center;

    padding:22px 28px;

    min-width:0;

    overflow:hidden;

}

.card-top{

display:flex;

align-items:flex-start;

gap:14px;

}

.icon{

width:46px;

height:46px;

border-radius:14px;

display:flex;

align-items:center;

justify-content:center;

font-size:22px;

color:white;

font-weight:bold;

}

.black{

background:#222;

}

.green{

background:#10b981;

}

.blue{

background:#3b82f6;

}

.orange{

background:#f59e0b;

}

.yellow{

background:#eab308;

}

.card-title{

font-size:15px;

color:#666;

margin-bottom:8px;

}

.card-value{

    font-size:clamp(26px,1.8vw,42px);

    font-weight:700;

    color:#222;

    line-height:1.15;

    margin-bottom:10px;

}


.card-sub{

font-size:14px;

color:#888;

line-height:1.5;

}
/*=============================
Pending Table
=============================*/

.table-header{

    display:flex;
    flex-direction:column;
    gap:18px;

}


.table-header h2{

    margin-bottom:18px;

}

.table-tools{

background:#fafafa;

border:1px solid #ececec;

border-radius:14px;

padding:18px;

display:flex;

flex-direction:column;

gap:16px;



}

.search-row{

    width:100%;

}

.search-row input{

    width:100%;

    max-width:500px;

}

.filter-row{

    display:flex;

    gap:10px;

    flex-wrap:wrap;

    align-items:center;

   

}

.date-row{

    display:flex;

    align-items:center;

    gap:14px;

    flex-wrap:wrap;

}

.date-row label{

    width:150px;

    white-space:nowrap;

    font-weight:600;

    color:#444;

    font-size:14px;

}


.table-tools input,
.table-tools select{

padding:10px 14px;
border:1px solid #ddd;
border-radius:10px;
font-size:14px;
background:#fff;

}

.table-tools input{

    width:220px;

}

input[type="date"]{

    width:170px;

}


.table-wrapper{

    overflow:auto;
    border-radius:12px;

}

table{

    width:100%;
    border-collapse:collapse;
    table-layout:fixed;
    background:white;

}

thead{

    background:#2b2b2b;
    position:sticky;
    top:0;
    z-index:5;

}

th{

    background:#2b2b2b;
    color:#c9c9c9;
    padding:16px;
    font-weight:600;
    font-size:14px;
    text-align:center;
    border-bottom:2px solid #FFD400;
    transition:.2s;

}

td{

    padding:14px 16px;
    font-size:14px;
    text-align:center;
    vertical-align:middle;
    border-bottom:1px solid #e5e7eb;


}

tbody tr{

    transition:.15s;

}

tbody tr:hover{

    background:#FFF4CC;

}

/* =============================
   Pagination
============================= */

.pagination{

    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-top:20px;
    gap:20px;

}

/* =============================
   Page Size Buttons
============================= */

.page-size-buttons{

    display:flex;
    align-items:center;
    gap:8px;

}

.page-size{

    border:none;
    background:transparent;
    color:#777;
    padding:7px 14px;
    border-radius:8px;
    cursor:pointer;
    font-weight:600;
    transition:.2s;

}

.page-size:hover{

    background:#FFD400;
    color:#222;

}

.page-size.active{

    background:#FFD400;
    color:#222;

}

.page-nav{

    display:flex;
    align-items:center;
    gap:10px;

}

.page-nav button{

    width:34px;
    height:34px;
    border:none;
    border-radius:8px;
    background:#FFC107;
    color:#222;
    font-weight:bold;
    cursor:pointer;

}

.page-nav button:hover{

    background:#FFB300;

}


/* =============================
   Sort
============================= */

.sortable{

    white-space:nowrap;

    cursor:pointer;

    user-select:none;

}

.sortable:hover{

    color:#f4b400;

}

.sort-icon{

    display:inline-block;

    margin-left:6px;

    font-size:11px;

    color:#9ca3af;

    vertical-align:middle;

    line-height:1;

}

.sortable:hover .sort-icon{

    color:#FFD400;

}

/* =============================
   Type Badge
============================= */

.type-badge{

    display:inline-block;
    padding:7px 14px;
    border-radius:999px;
    font-size:13px;
    font-weight:600;

}

/* Type */

.type-ecom{

    background:#EFE4FF;
    color:#7C3AED;

}

.type-extra{

    background:#FFE7D6;
    color:#EA580C;

}

.type-new{

    background:#DCFCE7;
    color:#15803D;

}

.type-normal{

    background:#FFE066;
    color:#7A5200;

}

.type-special{

    background:#FDE2E2;
    color:#DC2626;

}

/* =============================
   Aging Badge
============================= */

.aging-badge{

    display:inline-block;
    min-width:58px;
    text-align:center;
    padding:6px 12px;
    border-radius:999px;
    font-weight:700;
    font-size:13px;

}

.aging-green{

    background:#DCFCE7;
    color:#15803D;

}

.aging-yellow{

    background:#FEF3C7;
    color:#B45309;

}

.aging-orange{

    background:#FFEDD5;
    color:#EA580C;

}

.aging-red{

    background:#FEE2E2;
    color:#DC2626;

}
.money{

    font-weight:600;


}
.remark{

    max-width:260px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;

}
/* ===========================
   Active Sort
=========================== */

thead th.active-sort{

    background:#353535 !important;
    color:#FFD400 !important;
    box-shadow:inset 0 -4px 0 #FFD400;

}

thead th.active-sort .sort-icon{

    color:#FFD400 !important;

}
.type-badge,
.aging-badge{

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

}

.page-label{

    color:#666;
    font-size:14px;
    font-weight:600;
    margin-right:8px;

}
.search-row{

    display:flex;
    gap:12px;
    align-items:center;

}

.search-row input{

    flex:1;
    max-width:500px;

}

#clearFilterBtn{

    background:#ef4444;
    color:white;
    border:none;
    border-radius:10px;
    padding:10px 18px;
    font-size:14px;
    font-weight:600;
    cursor:pointer;
    transition:.2s;

}

#clearFilterBtn:hover{

    background:#dc2626;

}
.page-nav button:disabled{

    opacity:.35;
    cursor:not-allowed;
    background:#ddd;
    color:#888;

}
/* ===============================
   Loading Status
================================ */

.loading-status{

    display:flex;
    align-items:center;
    gap:12px;

    margin-top:10px;

    font-size:20px;      /* จาก 15 → 20 (+33%) */

    font-weight:700;

    color:#f59e0b;

}


.loading-spinner{

    width:23px;
    height:23px;

    border:3px solid #fde68a;
    border-top:3px solid #f59e0b;

    border-radius:50%;

    animation:spin .8s linear infinite;

}

.loading-text{

    animation:pulse 1.2s infinite;

}

@keyframes spin{

    from{transform:rotate(0deg);}
    to{transform:rotate(360deg);}

}

@keyframes pulse{

    0%{opacity:.45;}
    50%{opacity:1;}
    100%{opacity:.45;}

}

.header-left{

    display:flex;

    flex-direction:column;

    gap:8px;

}
/* ==========================
   Dashboard Analytics
========================== */

.chart-grid{

    display:grid;

    grid-template-columns:repeat(auto-fit,minmax(430px,1fr));

    gap:24px;

    margin-top:40px;

    margin-bottom:60px;

}

.chart-box{

    position:relative;

    background:#fff;

    border:1px solid #e9ecef;

    border-radius:20px;

    padding:22px 24px;

    min-height:460px;

    height:auto;

    display:flex;

    flex-direction:column;

    box-shadow:0 6px 18px rgba(0,0,0,.05);

}



.chart-box:hover{

    transform:translateY(-4px);

    box-shadow:

        0 12px 30px rgba(0,0,0,.10);

}

.chart-header{

    display:flex;

    justify-content:space-between;

    align-items:center;

    padding-bottom:16px;

    margin-bottom:20px;

    border-bottom:1px solid #ececec;

}



.chart-header h3{

    font-size:20px;

    font-weight:700;

    color:#2d3436;

}



.chart-header span{

    color:#999;

    font-size:13px;

}

.chart-header span:hover{

    color:#FFC107;

}

.chart-box canvas{

    flex:1;

    width:100% !important;

    max-height:220px;

    cursor:pointer;

}
/* ==========================
   IB Type Layout
========================== */

.type-layout{

    flex:1;

    display:flex;

    align-items:center;

    justify-content:space-between;

    gap:36px;

}

.type-chart{

    flex:0 0 52%;

    display:flex;

    justify-content:center;

    align-items:center;

}

.type-chart canvas{

    width:100%!important;

    height:100%!important;

    max-width:330px;

    max-height:330px;

}

.custom-legend{

    flex:1;

    display:flex;

    flex-direction:column;

    justify-content:center;

    gap:16px;

}

.legend-item{

    display:flex;

    justify-content:space-between;

    align-items:center;

    padding:14px 18px;

    border-radius:12px;

    background:#f8fafc;

    transition:.25s;

    border:1px solid #edf2f7;

}


.legend-item:hover{

    background:#eef4ff;

    transform:translateX(4px);

    border-color:#dbeafe;

}

.legend-left{

    display:flex;

    align-items:center;

    gap:12px;

}

.legend-color{

    width:14px;

    height:14px;

    border-radius:50%;

}



.legend-label{

    font-size:15px;

    font-weight:600;

    color:#444;

}

.legend-value{

    font-size:18px;

    font-weight:700;

    color:#222;

}
/* ==========================
   Responsive Desktop
========================== */

@media (max-width:1700px){

    .cards{

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

    }

}

@media (max-width:1450px){

    .cards{

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

    }

    .chart-grid{

        grid-template-columns:1fr;

    }

}

@media (max-width:900px){

    .cards{

        grid-template-columns:1fr;

    }

    .chart-grid{

        grid-template-columns:1fr;

    }

}
/* ===========================
   Dashboard Analytics
=========================== */

.analytics-card{

    margin-top:35px;

}

.analytics-card h2{

    margin-bottom:20px;

}



