html,
body{
    height:100%;
}

main{
    flex:1;
}

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

body {
    /* background: #f1f5f9; */
    background: linear-gradient( 180deg,#e2e8f0 0%,#dbeafe 40%,#bfdbfe 100%);
    color: #0f172a;
    font-family: 'Segoe UI', sans-serif;
    min-height:100vh;
    display:flex;
    flex-direction:column;
}

/* =========================================
   Header SECTION
========================================= */

.topbar {
  background: #0f172a;
  color: white;
  /* padding: 12px 30px; */
  /* padding:8px 20px; */
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.main-logo {
  width: 70px;
}

/* =========================================
   PROFILE SECTION
========================================= */
.profile-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.profile-details h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: white;
}

.profile-details span {
    font-size: 15px;
    color: #cbd5e1;
}

.profile-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.logout-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* =========================================
   APPLICATION NAVIGATION
========================================= */
.app-navigation{
    display:flex;
    justify-content:center;
    gap:18px;
    padding:20px 0;
    /* background:#f1f5f9; */
    background:transparent;
    position:sticky;
    top:0;
    z-index:100;
}

.app-tab{
    border:none;
    padding:12px 24px;
    border-radius:50px;
    background:white;
    color:#0f172a;
    font-size:14px;
    font-weight:700;
    cursor:pointer;
    transition:.25s;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    display:flex;
    align-items:center;
    gap:10px;
}

.app-tab:hover{
    transform:translateY(-2px);
    background:#e0f2fe;
}

.app-tab.active{
    background:linear-gradient( 135deg,#0891b2,#1d4ed8);
    color:white;
}

/* =========================================
   VIEWS
========================================= */
.app-view{
    display:none;
    flex:1;
    width:100%;
}

.app-view.active-view{
    display:flex;
    flex-direction:column;
}

/* =========================================
   Hero SECTION
========================================= */
#homeView{
    /* display: flex; */
    flex: 1;
}

.hero-section {
    flex: 1;
    min-height: 480px;      /* was 600px */
    margin: 24px;
    padding: 36px;
    border-radius: 24px;
    background: linear-gradient(135deg,#0891b2,#1d4ed8,#0f172a);
    color: white;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.hero-left h2 {
  font-size: 58px;
  line-height: 1.2;
}

.hero-left span {
  color: #67e8f9;
}

.hero-left p {
  margin-top: 20px;
  line-height: 1.8;
  font-size: 18px;
}

.hero-buttons {
  margin-top: 30px;
  display: flex;
  gap: 15px;
}

.primary-btn {
  background: white;
  color: #0f172a;
}

.secondary-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
}

.hero-right {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 20px;
}

.stat-card {
  background: rgba(255,255,255,0.1);
  padding: 30px;
  border-radius: 25px;
  backdrop-filter: blur(10px);
}

.stat-card h1 {
  font-size: 46px;
}

.module-section{
     padding:0 10px 8px;
}

/* ========================================
   Modules SECTION
======================================== */
.workspace-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap:12px;
    margin-bottom:4px;
}

#workspaceTitle{
    font-size:24px;
    margin:0;
    line-height:1.2;
    font-weight:800;
    background: linear-gradient( 135deg,#0891b2,#1d4ed8);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
}

.module-toolbar{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:6px;
    margin:2px 0 4px;
}

.module-buttons{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    flex:1;
}

.module-actions{
    display:flex;
    align-items:center;
    gap:8px;
}

.header-search{
    margin-left:auto;
    display:flex;
    justify-content:flex-end;
    align-items:center;
}

.header-search input{
    width:320px;
    height:38px;
    padding:0 16px;
    border-radius:10px;
    border:1px solid #cbd5e1;
}

.module-nav{
    border:none;
    background:#eef4fb;
    color:#1e3a5f;
    border:1px solid #d5e2f1;
    padding:4px 12px;
    height:30px;
    text-align:left;
    border-radius:8px;
    font-size:12px;
    font-weight:700;
    cursor:pointer;
    transition:.25s;
}

.module-nav:hover{
    background:#d9ecff;
    color:#0f4c81;
}

.module-nav.active{
    background: linear-gradient(135deg, #0891b2, #2563eb);
    color:white;
    box-shadow: 0 5px 15px rgba(25,118,210,.25);
}

.workspace-content{
    width:100%;
    margin:0;
    background:rgba(255,255,255,0.96);
    backdrop-filter:blur(8px);
    border-radius:0;
    padding:4px;    
    box-shadow:none;
    position:relative;
    flex:1; 
    display:flex;
    flex-direction:column;
    overflow:hidden;  
    min-height:0; 
}

#materialGrid{
    width:100%;
    flex:1;
    min-height:0;
}

#moduleView{
    flex:1;
    min-height:calc(100vh - 110px);
}

/* #moduleView{
    display:flex;
    flex-direction:column;
    flex:1;
    height:calc(100vh - 90px);
    overflow:hidden;
} */

.grid-wrapper{
    flex:1;
    min-height:850px;
    display:flex;
    overflow:hidden;
}

.grid-loader{
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(255,255,255,0.85);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.loader-spinner{
    width:50px;
    height:50px;
    border:4px solid #dbeafe;
    border-top:4px solid #0891b2;
    border-radius:50%;
    animation:spin 1s linear infinite;
}

.loader-text{
    margin-top:15px;
    font-weight:600;
    color:#0f172a;
}

@keyframes spin{
    100%{
        transform:rotate(360deg);
    }
}



/* ######OLD */

.section-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 30px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(320px,1fr));
  gap: 30px;
}

.module-card {
  background: white;
  padding: 35px;
  border-radius: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.module-icon {
  width: 90px;
  height: 90px;
  border-radius: 28px;
  background: linear-gradient(
    135deg,
    #dbeafe,
    #cffafe
  );

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

  font-size: 42px;
  color: #0891b2;

  box-shadow:
    inset 0 2px 10px rgba(255,255,255,0.7),
    0 8px 20px rgba(0,0,0,0.08);
}

.module-card h2 {
  margin-top: 25px;
  font-size: 30px;
}

.module-card p {
  margin-top: 15px;
  line-height: 1.8;
}

.open-btn {
  margin-top: 20px;
  color: #0891b2;
  font-weight: bold;
  cursor: pointer;
}

.open-btn:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}

/* ========================================
   MODAL
======================================== */
/*MODULE TITLE SECTION */
.module-title-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    padding: 10px 16px;
    border-left: 6px solid #0891b2;
    background: linear-gradient(to right, rgba(8,145,178,0.08), transparent);
    border-radius: 14px;
}

/* ICON */
.module-icon {
    width: 58px;
    height: 58px;
    min-width: 58px;
    border-radius: 16px;
    background: #0891b2;
    color: white;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(15,118,110,0.25);
}

/* TEXT SECTION */
.module-text {
    display: flex;
    flex-direction: column;
}

/* TITLE */
.module-text h1 {
    margin: 0;
    font-size: 34px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

/* SUBTITLE */
.module-text p {
    margin: 4px 0 0 0;
    font-size: 15px;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* =========================================
   MATERIAL GRID HEADER
========================================= */
.material-module-title-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    padding: 10px 16px;
    border-left: 6px solid #0f4c81;
    background: linear-gradient(to right, rgba(29,78,216,0.10), transparent);
    border-radius: 14px;
}

/* ICON */
.material-module-icon {
    width: 58px;
    height: 58px;
    min-width: 58px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f4c81, #0891b2);
    color: white;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:0 6px 18px rgba(37,99,235,0.25);
}

.modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,0.75);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
  padding:30px;
}

.modal-content{
  width:96%;
  max-width: 1800px;
  height:92vh;
  background:white;
  border-radius:28px;
  padding:25px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.modal-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 16px;
}

.close-btn{
  width:45px;
  height:45px;
  border:none;
  border-radius:14px;
  cursor:pointer;
  font-size:22px;
  background:#ef4444;
  color:white;
}

.grid-toolbar {
    margin-top: 20px;
    background:#f5f9ff;
    border:1px solid #d9e4f2;
    border-radius:10px;
    padding:10px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    overflow-x: auto;
}

.grid-toolbar button,
.upload-btn,
#exportBtn,
#saveChangesBtn{
    height:32px;
    padding:0 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #0f4c81, #0891b2);
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    white-space: nowrap;
    gap:6px; 
}

/* HOVER EFFECT */
.upload-btn:hover,
#exportBtn:hover,
#saveChangesBtn:hover{
    transform:translateY(-2px);
    opacity:.92;
}

.grid-toolbar input[type="text"] {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    min-width: 280px;
    height: 46px;
}

/* CUSTOM FILE UPLOAD */
.custom-file-upload {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* HIDE ORIGINAL INPUT */
.custom-file-upload input[type="file"] {
    display: none;
}

.upload-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* FILE NAME */
#fileName{
    min-width:150px;
    font-weight:500;
    color:#64748b;
}

#quickSearch{
    width:300px;
    height:38px;
    font-size:13px;
    padding:0 16px;
    border:1px solid #cbd5e1;
    border-radius:12px;
    font-size:13px;
}

/* =========================================
   COMPACT AG GRID
========================================= */
.ag-theme-alpine {
    --ag-font-size: 11px;
    --ag-grid-size: 3px;
    --ag-list-item-height: 22px;
    --ag-row-height: 26px;
    --ag-header-height: 34px;
    --ag-header-foreground-color: #0f172a;
    --ag-header-background-color: #f8fafc;
    --ag-borders: solid 1px #dbe2ea;
}

/* =========================================
   HEADER STYLE LIKE BUTTONS
========================================= */
/* AG GRID HEADER */
.ag-theme-alpine{
    --ag-header-background-color:#0f4c81;
    --ag-header-foreground-color:white;
    --ag-row-height:24px;
    --ag-header-height:34px;
    --ag-font-size:8px;
    
}
/* HEADER BACKGROUND */
.ag-theme-alpine .ag-header {
    background:#0f4c81;
    border-bottom: 1px solid #1e40af;
}

/* HEADER CELLS */
.ag-theme-alpine .ag-header-cell {
    background:#0f4c81;
    color: white;
    border-right: 1px solid rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* HEADER TEXT */
.ag-theme-alpine .ag-header-cell-label {
    justify-content: center;
    text-align: center;
    width: 100%;
    color:white;
    font-weight:700;
}

/* HEADER FONT */
.ag-theme-alpine .ag-header-cell-text {
    color: white;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 14px;
}

/* HEADER ICONS */
.ag-theme-alpine .ag-header-icon,
.ag-theme-alpine .ag-icon {
    color: #115e59;
}

/* FLOATING FILTER ROW */
.ag-theme-alpine .ag-floating-filter {
    background:#eef5fc;
    border-top: 1px solid rgba(255,255,255,0.18);
}

/* REMOVE EXTRA HEADER SHADOW */
.ag-theme-alpine .ag-header,
.ag-theme-alpine .ag-pinned-left-header {
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.ag-row:nth-child(even){
    background:#fbfcfe;
}

.ag-row:hover{
    background:#eaf4ff;
}

/* =========================================
   DARKER FILTER ICON
========================================= */
.ag-header-icon,
.ag-floating-filter-button-button,
.ag-icon-filter,
.ag-icon-menu {
    color: #0f172a;
    opacity: 1;
}

/* FILTER BUTTON HOVER */
.ag-floating-filter-button-button:hover {
    color: #0891b2;
}

/* =========================================
   COMPACT CELL PADDING
========================================= */
.ag-cell,
.ag-header-cell {
    padding-left: 6px;
    padding-right: 6px;}

/* =========================================
   SMALL FILTER INPUTS
========================================= */
.ag-floating-filter-body input {
    height:20px;
    font-size:10px;
    padding: 0 6px;
}

/* =========================================
   DATE FILTER PLACEHOLDER RIGHT ALIGN
========================================= */
.ag-floating-filter-body input[type="date"] {
    text-align: center;
    direction: ltr;
    padding-right: 12px; 
    padding-left: 6px;
    color: white;
}

/* FIX ACTUAL SELECTED DATE ALIGNMENT */
.ag-floating-filter-body input[type="date"]::-webkit-datetime-edit {
    direction: ltr;
    text-align: center;
}

/* REMOVE CALENDAR ICON */
.ag-floating-filter-body input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 1;
    display: block;
    cursor: pointer;
    position: absolute;
    right: 8px;
}

/* =========================================
   CENTER TEXT FILTER PLACEHOLDER
========================================= */
.ag-floating-filter-body input[type="text"] {
    text-align: center;
    padding-left: 10px;
    padding-right: 10px;
}

/* =========================================
   CENTER PLACEHOLDER TEXT
========================================= */
.ag-floating-filter-body input[type="text"]::placeholder {
    text-align: center;
}

/* =========================================
   CENTER FILTER POPUP INPUT TEXT
========================================= */
.ag-filter input,
.ag-text-field-input {
  text-align: center;
}

/* =========================================
   CENTER PLACEHOLDER INSIDE FILTER POPUP
========================================= */
.ag-filter input::placeholder,
.ag-text-field-input::placeholder {
    text-align: center;
}

/* =========================================
   EXCEL STYLE CELL SELECTION
========================================= */
.ag-cell-range-selected {
  background-color: rgba(37,99,235,0.12);
}

/* ACTIVE EDIT CELL */
.ag-cell-focus {
  border: 2px solid #2563eb;
}

/* ========================================
   ANALYTICS SECTION
======================================== */
.analytics-section {
    padding: 0 40px 50px;
}

#analyticsView .workspace-content{
    background:rgba(255,255,255,.96);
    padding:12px 16px;
    display:flex;
    flex-direction:column;
    width:100%;
}

#analyticsView .grid-wrapper{
    position:relative;
    height:780px;
}

#analyticsShipmentGrid{
    width:100%;
    height:780px;
}

#analyticsDailyGrid{
    width:100%;
    height:780px;
}

#analyticsWeeklyGrid{
    width:100%;
    height:780px;
}


/* ========================================
   Dashboard SECTION
======================================== */
/* HEADER*/
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h2 {
    font-size: 42px;
    color: #0f172a;
}

.dashboard-header p {
    margin-top: 8px;
    color: #64748b;
    font-size: 16px;
}

/* LIVE BADGE  */
.live-badge {
    background: #cffafe;
    color: #0f766e;
    padding: 12px 18px;
    border-radius: 14px;
    font-weight: bold;
    font-size: 14px;
}

.dashboard-card {
    background: white;
    border-radius: 30px;
    padding: 35px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.08);
}

.large-card {
    min-height: 650px;
}

/* KPI CARDS */
.kpi-container{
    display:grid;
    grid-template-columns:repeat(5,1fr);
    gap:20px;
    margin-top:25px;
    margin-bottom:25px;
}

.kpi-card{
    background:linear-gradient(135deg,#0891b2,#1d4ed8);
    color:white;
    padding:24px;
    border-radius:18px;
    text-align:center;
    box-shadow:0 8px 20px rgba(0,0,0,.15);
}

.kpi-card h2{
    margin:0;
    font-size:34px;
    font-weight:800;
}

.kpi-card span{
    display:block;
    margin-top:8px;
    font-size:14px;
}

/* CHART GRID */
.chart-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:20px;
}

.chart-box{
    background:white;
    border-radius:18px;
    padding:20px;
    min-height:350px;
}

/* CHART BOX */
.chart-box {
    margin-top: 30px;
    height: 500px;
    border-radius: 24px;
    background: linear-gradient(to bottom right, #f8fafc, #e2e8f0);
    border: 1px solid #cbd5e1;
    padding: 25px;
}

/* ========================================
   RESPONSIVE
======================================== */
@media(max-width: 768px){
    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* ========================================
   RESPONSIVE
======================================== */
@media(max-width: 1100px){
  .analytics-section {
    grid-template-columns: 1fr;
  }
}

@media(max-width: 768px){
  .analytics-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
}

.footer {
  background: white;
  padding: 25px 40px;
  border-top: 1px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  margin-top:0;
}

.footer-links {
  display: flex;
  gap: 25px;
  color: #64748b;
}

@media(max-width: 1100px){
  .hero-section,
  .analytics-section {
    grid-template-columns: 1fr;
  }
}

@media(max-width: 768px){
  .topbar,
  .section-header,
  .footer {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }

  .hero-left h2 {
    font-size: 38px;
  }

  .hero-right {
    grid-template-columns: 1fr;
  }
}