/* LAYOUT CSS - Common layout styles */

/* HEADER */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background: var(--bg-secondary);
  color: white;
  align-items: center;
  padding: 10px 15px;
  box-sizing: border-box;
  z-index: 9999;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
  justify-content: flex-end;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
  justify-content: flex-start;
}

/* HEADER SUBMENU */
.more-options {
  position: relative;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: all 0.3s;
}

.more-options:hover {
  background: var(--hover);
}

.header-submenu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 5px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 180px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: none;
  animation: slideDown 0.2s ease;
}
@media (max-width: 768px) {
  .header-submenu {
  margin-top: 17px;
}
}
.header-submenu.show {
  display: block;
}

.header-submenu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 13px;
}

.header-submenu-item:hover {
  background: var(--btn-view);
  color: var(--accent);
}

.header-submenu-item i {
  font-size: 14px;
  width: 16px;
  text-align: center;
}

.header-submenu-divider {
  height: 1px;
  background: var(--border);
  margin: 5px 0;
}

.header-submenu-logout {
  color: var(--btn-delete);
}

.header-submenu-logout:hover {
  background: var(--btn-delete);
  color: #ffffff;
}

/* FOOTER */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 65px;
  background: var(--bg-secondary);
  color: white;
  display: none;
  align-items: center;
  justify-content: space-around;
  padding: 8px 0;
  box-sizing: border-box;
  z-index: 9999;
  border-top: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

/* CONTAINER */
.container {
  position: fixed;
  top: 60px;
  bottom: 0;
  left: 0;
  right: 0;
  overflow-y: auto;
  background: var(--bg-primary);
  padding: 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--btn-view) transparent;
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 250px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: none;
  z-index: 9999;
  flex-direction: column;
  transition: width 0.3s ease;
}

.sidebar.collapsed {
  width: 90px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(45, 74, 48, 0.9) transparent;
}

.sidebar.collapsed .sidebar-content {
  padding: 10px 0;
  flex: none;
  overflow-y: visible;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.sidebar.collapsed .logo {
  justify-content: center;
  padding: 20px 10px;
}

.sidebar.collapsed .logo .brand-name {
  display: none;
}

.language-section {
  padding: 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.sidebar.collapsed .language-section {
  padding: 10px 5px;
  text-align: center;
  margin-top: auto;
}

.sidebar.collapsed .theme-section {
  padding: 10px 5px;
  text-align: center;
}

.sidebar.collapsed .theme-title {
}

.sidebar.collapsed .theme-buttons {
  flex-wrap: wrap;
  gap: 5px;
}

.sidebar.collapsed .theme-btn {
  width: 24px;
  height: 24px;
}

.sidebar.collapsed .theme-preview {
  width: 14px;
  height: 14px;
}

/* CONTENT */
.content {
  padding: 15px 5px;
}

/* RESPONSIVE STYLES */
@media (min-width: 769px) {
  .header {
    left: 250px;
    width: calc(100% - 250px);
    transition: left 0.3s ease, width 0.3s ease;
  }

  .container {
    left: 250px;
    right: 0;
    transition: left 0.3s ease;
  }

  .footer {
    display: none;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
  }

  .collapse-btn {
    display: block;
  }

  /* Collapsed sidebar state */
  body.sidebar-collapsed .header {
    left: 90px;
    width: calc(100% - 90px);
  }

  body.sidebar-collapsed .container {
    left: 90px;
  }
}

@media (max-width: 768px) {
  .header {
    left: 0;
    width: 100%;
  }

  .container {
    left: 0;
    right: 0;
    bottom: 65px;
  }

  .footer {
    left: 0;
    width: 100%;
    display: flex !important;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  .sidebar {
    display: none;
  }

  .collapse-btn {
    display: none;
  }
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
  .footer {
    position: fixed;
    display: flex !important;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  .footer-nav-item i,
  .footer-nav-item span {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}
