/* =============================================
   Kuaförim App - Main Layout
   ============================================= */

/* App Shell */
#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: var(--max-width);
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg-dark);
}

/* Pages Container */
.pages-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Page */
.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  background: var(--bg-dark);
  -webkit-overflow-scrolling: touch;
}

.page.active {
  display: flex;
  flex-direction: column;
}

/* Page with tabbar */
.page.has-tabbar {
  padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom));
}

/* Top Navigation Bar */
.top-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-navbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  padding-top: calc(var(--safe-top) + var(--space-sm));
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-height: var(--navbar-height);
}

.top-nav .nav-title {
  font-size: var(--font-lg);
  font-weight: var(--font-weight-bold);
}

.top-nav .nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.top-nav .nav-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  position: relative;
}

.top-nav .nav-btn:active {
  background: rgba(255,255,255,0.1);
}

.top-nav .nav-btn .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  border-radius: var(--radius-full);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
}

/* Bottom Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: calc(var(--tabbar-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: var(--z-navbar);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.tab-bar .tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--space-xs) 0;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  position: relative;
}

.tab-bar .tab-item.active {
  color: var(--text-primary);
}

.tab-bar .tab-item .tab-icon {
  font-size: 22px;
  line-height: 1;
}

.tab-bar .tab-item .tab-label {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
}

/* Center upload button */
.tab-bar .tab-upload {
  position: relative;
}

.tab-bar .tab-upload .upload-btn {
  width: 44px;
  height: 32px;
  background: linear-gradient(135deg, #D4A017, #FFD700);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(212, 160, 23, 0.4);
  position: relative;
  overflow: hidden;
}

.tab-bar .tab-upload .upload-btn::before {
  content: '';
  position: absolute;
  left: -3px;
  top: 0;
  width: 100%;
  height: 100%;
  background: #B8860B;
  border-radius: var(--radius-sm);
  z-index: -1;
}

.tab-bar .tab-upload .upload-btn::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 0;
  width: 100%;
  height: 100%;
  background: #FFD700;
  border-radius: var(--radius-sm);
  z-index: -1;
}

.tab-bar .tab-upload .upload-btn i {
  font-size: 20px;
  color: #fff;
  position: relative;
  z-index: 1;
}

/* Scroll content area */
.scroll-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Pull to refresh */
.pull-to-refresh {
  position: absolute;
  top: -50px;
  left: 0;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--font-sm);
  transition: transform var(--transition-normal);
}

.pull-to-refresh.pulling {
  transform: translateY(50px);
}

.pull-to-refresh .spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
}

.section-header h2 {
  font-size: var(--font-lg);
  font-weight: var(--font-weight-bold);
}

.section-header .see-all {
  font-size: var(--font-sm);
  color: var(--primary);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xxl) var(--space-lg);
  text-align: center;
  gap: var(--space-md);
}

.empty-state i {
  font-size: 48px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: var(--font-lg);
  color: var(--text-secondary);
}

.empty-state p {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: 0 var(--space-md);
}
