/* Mobile First Layout Constraints */
body{
  background-color:var(--bg-base);
  color:var(--text-primary);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  padding-bottom:calc(60px + var(--safe-area-bottom)); /* For bottom nav */
}

/* App Wrapper */
.app-wrapper{
  display:flex;
  flex-direction:column;
  min-height:100vh;
}

/* Container */
.container{
  width:100%;
  padding:0 var(--space-2);
  margin:auto;
}

/* Tablet / Desktop Constraints (Centralized Mobile View) */
@media(min-width:768px){
  .container{
    max-width:768px;
  }
}

@media(min-width:1200px){
  .container{
    max-width:var(--container);
  }
}

/* Header Layout */
.header{
  position:sticky;
  top:0;
  z-index:100;
  background-color:#0f172a !important; /* KT&G Premium Dark Slate */
  display:flex;
  justify-content:space-between;
  align-items:center;
  height:48px;
  padding:0 var(--space-2);
  border-bottom:1px solid rgba(255,255,255,0.1);
}

/* Bottom Nav Layout */
.bottom-nav{
  position:fixed;
  bottom:0;
  left:0;
  width:100%;
  z-index:100;
  background-color:#0f172a !important; /* KT&G Premium Dark Slate */
  border-top:1px solid rgba(255,255,255,0.1);
  display:flex;
  justify-content:space-around;
  align-items:center;
  height:60px;
  padding-bottom:env(safe-area-inset-bottom);
}

.bottom-nav-item{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  color:#cbd5e1 !important;
  font-size:10px;
  height:100%;
}
.bottom-nav-item.active{
  color:var(--brand-secondary) !important;
}
.bottom-nav-item svg{
  width:24px;
  height:24px;
  fill:currentColor;
}

/* Main Content Area */
.main-content{
  flex:1;
  padding-top:var(--space-2);
  padding-bottom:var(--space-4);
}

/* PC vs Mobile Header styles & GNB */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-nav {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  margin-top: 8px;
  width: 100%;
  border-top: 1px solid var(--bg-overlay);
  padding: 8px 0 0 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.header-nav::-webkit-scrollbar {
  display: none;
}

.header-nav-item {
  color: #94a3b8 !important; /* Slate 400 */
  font-weight: 700;
  text-decoration: none;
  font-size: 17px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.header-nav-item:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

.header-nav-item.active {
  color: var(--brand-secondary) !important; /* KT&G Emerald Green */
  background: rgba(0, 135, 90, 0.15) !important;
  border-bottom: 2px solid var(--brand-secondary) !important;
}

.header .logo {
  color: #ffffff !important;
}
.header .text-user {
  color: #cbd5e1 !important;
}
.header .header-right a {
  color: #cbd5e1 !important;
}
.header .header-right a:hover {
  color: #ffffff !important;
}

/* Default PC layout rules (No media query wrapper: applies to PC) */
body {
  padding-bottom: var(--space-4) !important;
}
.bottom-nav {
  display: none !important;
}
.header {
  height: auto !important;
  flex-direction: column !important;
  padding-top: 10px !important;
  padding-bottom: 8px !important;
  align-items: stretch !important;
}
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 40px;
}
.header-nav {
  display: flex !important;
}
.header-nav-item {
  font-size: 18px !important;
  padding: 8px 20px !important;
}
.main-content h1.fs-h1, .diary-container h1.fs-h1, .profile-container h1.fs-h1 {
  font-size: 16px !important;
  color: var(--brand-primary) !important; /* KT&G Midnight Blue */
  margin-bottom: 4px !important;
}
.main-content h1.fs-h1 + p, .portfolio-subtitle {
  font-size: 13.5px !important;
  color: var(--text-secondary) !important;
  opacity: 0.85 !important;
  margin-top: 2px !important;
  margin-bottom: 6px !important;
}
.main-content .fs-title, .diary-container .fs-title, .main-content h5.fs-title {
  font-size: 12px !important;
}
.hide-pc {
  display: none !important;
}
.hide-mobile {
  /* Default display behavior */
}

/* Mobile override styles (max-width: 768px) */
@media (max-width: 768px) {
  body {
    padding-bottom: calc(60px + var(--safe-area-bottom)) !important;
  }
  .bottom-nav {
    display: flex !important;
  }
  .header {
    height: 48px !important;
    flex-direction: row !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  .header-top {
    height: 100% !important;
  }
  .header-nav {
    display: none !important;
  }
  .header .text-user {
    display: none !important;
  }
  .hide-mobile {
    display: none !important;
  }
  .hide-pc {
    display: block !important;
  }
  thead.hide-pc {
    display: table-header-group !important;
  }
  tbody.hide-pc {
    display: table-row-group !important;
  }
  tr.hide-pc {
    display: table-row !important;
  }
  th.hide-pc, td.hide-pc {
    display: table-cell !important;
  }
}
