/* Mobile Optimized CSS - sinocloud.it */

:root {
  --mobile-header-height: 60px;
  --mobile-menu-width: 280px;
  --touch-target-min: 44px;
}

/* Reset mobile-first */
* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

body.mobile-layout {
  font-size: 16px; /* Previene zoom su iOS */
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

/* Header Mobile */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-header-height);
  background: rgba(26, 26, 26, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.mobile-header .header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
  height: 100%;
}

.mobile-header .logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  color: #fff;
  text-decoration: none;
}

.mobile-header .logo img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

/* Header Actions */
.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.theme-toggle,
.mobile-menu-toggle {
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  padding: 10px;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.3s;
}

.theme-toggle:active,
.mobile-menu-toggle:active {
  background: rgba(255, 255, 255, 0.1);
}

/* Hamburger Icon */
.hamburger {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  position: relative;
  transition: all 0.3s;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background: #fff;
  transition: all 0.3s;
}

.hamburger::before { top: -8px; }
.hamburger::after { bottom: -8px; }

.mobile-menu-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger::before {
  transform: rotate(45deg);
  top: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger::after {
  transform: rotate(-45deg);
  bottom: 0;
}

/* Mobile Navigation */
.mobile-nav {
  position: fixed;
  top: var(--mobile-header-height);
  left: -100%;
  width: var(--mobile-menu-width);
  height: calc(100vh - var(--mobile-header-height));
  background: rgba(26, 26, 26, 0.98);
  backdrop-filter: blur(20px);
  overflow-y: auto;
  transition: left 0.3s ease;
  z-index: 999;
  box-shadow: 2px 0 15px rgba(0,0,0,0.5);
}

.mobile-nav.active {
  left: 0;
}

.mobile-nav ul {
  list-style: none;
  padding: 1rem 0;
  margin: 0;
}

.mobile-nav > ul > li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav a,
.mobile-nav .submenu-toggle {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  color: #fff;
  text-decoration: none;
  min-height: var(--touch-target-min);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.mobile-nav a:active,
.mobile-nav .submenu-toggle:active {
  background: rgba(255, 255, 255, 0.1);
}

.submenu-toggle {
  justify-content: space-between;
}

.submenu-toggle .fa-chevron-down {
  transition: transform 0.3s;
  font-size: 0.875rem;
}

.submenu-toggle[aria-expanded="true"] .fa-chevron-down {
  transform: rotate(180deg);
}

/* Submenu */
.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.3);
}

.submenu.active {
  max-height: 500px;
}

.submenu li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.submenu a {
  padding-left: 3rem;
  font-size: 0.9rem;
}

/* Switch Version */
.switch-version {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.desktop-link {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  font-weight: 600;
}

/* Overlay quando menu è aperto */
.mobile-nav-overlay {
  position: fixed;
  top: var(--mobile-header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 998;
}

.mobile-nav-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Main Content */
.mobile-main {
  margin-top: var(--mobile-header-height);
  min-height: calc(100vh - var(--mobile-header-height));
  padding: 1.5rem 1rem;
}

.mobile-content {
  max-width: 100%;
}

/* Background Mobile */
.mobile-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d3436 100%);
  background-size: cover;
  background-position: center;
  z-index: -1;
}

/* Footer Mobile */
.mobile-footer {
  background: rgba(26, 26, 26, 0.95);
  padding: 2rem 1rem;
  color: #fff;
}

.mobile-footer .footer-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.mobile-footer .footer-section h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.mobile-footer .footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-footer .footer-section li {
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.mobile-footer .footer-section a {
  color: #ccc;
  text-decoration: none;
}

.mobile-footer .social-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.mobile-footer .social-links a {
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: #fff;
  font-size: 1.2rem;
  transition: all 0.3s;
}

.mobile-footer .social-links a:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.2);
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
