/* Mobile-optimierte CSS für index.html - Handy-freundliches Design */

/* VIEWPORT UND GRUNDEINSTELLUNGEN */
@media screen and (max-width: 768px) {
  /* HEADER OPTIMIERUNGEN */
  .header-top {
    flex-direction: column !important;
    padding: 10px !important;
    gap: 10px;
  }
  
  .logo {
    font-size: 1.5rem !important;
    text-align: center;
  }
  
  .logo i {
    margin-right: 8px !important;
  }
  
  .user-actions {
    flex-wrap: wrap;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }
  
  .user-actions a {
    margin: 0 !important;
    padding: 6px 10px !important;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    font-size: 0.85rem !important;
  }
  
  /* Warenkorb auf Handy vergrößern */
  .user-actions a[href="cart.html"] {
    font-size: 1rem !important;
    padding: 8px 12px !important;
    font-weight: bold !important;
  }
  
  .user-actions a[href="cart.html"] i {
    font-size: 1.1rem !important;
  }
  
  /* Username verkürzen auf Handy */
  .user-info span {
    max-width: 60px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 0.85rem !important;
    margin-right: 15px !important;
  }
  
  /* User-Info Container nach links verschieben */
  .user-info {
    justify-content: flex-start !important;
    margin-right: auto !important;
    padding-right: 15px !important;
  }
  
  /* Angemeldet: Name weiter links positionieren */
  #userDisplay .user-info {
    order: -1 !important;
    flex: 1 !important;
  }
  
  /* Forum und Admin Links in Header auf Mobile */
  .header-nav {
    display: none !important;
  }
  
  /* Mobile Navigation direkt sichtbar machen */
  .mobile-nav-links {
    display: flex !important;
  }
  
  .mobile-nav-links a {
    padding: 6px 10px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 15px !important;
    font-size: 0.8rem !important;
    text-decoration: none !important;
    color: var(--light-text) !important;
  }
  
  /* Begrüßungsbereich auf Mobile anpassen */
  .welcome-banner {
    padding: 40px 0 !important;
  }
  
  .welcome-content h1 {
    font-size: 1.8rem !important;
  }
  
  .welcome-content p {
    font-size: 1rem !important;
    padding: 0 20px !important;
  }
  
  .header-nav {
    padding: 15px 10px !important;
  }
  
  .header-nav ul {
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
  }
  
  .header-nav li {
    margin: 0 !important;
  }
  
  .header-nav a {
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    font-size: 0.9rem;
  }
  
  /* KATEGORIEN OPTIMIERUNG */
  .categories {
    padding: 30px 0 !important;
  }
  
  .category-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px !important;
    padding: 0 10px;
  }
  
  .category-card img {
    height: 120px !important;
  }
  
  .category-card h3 {
    font-size: 1rem !important;
    padding: 10px 8px !important;
  }
  
  /* PRODUKTGRID HANDY-OPTIMIERUNG */
  .product-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 0 10px !important;
    justify-content: center !important;
  }
  
  .product-card {
    font-size: 0.85rem !important;
    border-radius: 12px !important;
    overflow: hidden;
  }
  
  .product-card img {
    height: 140px !important;
    object-fit: cover;
  }
  
  .product-info {
    padding: 10px 8px !important;
  }
  
  .product-title {
    font-size: 0.95rem !important;
    line-height: 1.3 !important;
    margin-bottom: 8px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .product-price {
    font-size: 1.1rem !important;
    margin-bottom: 8px !important;
  }
  
  .product-rating {
    font-size: 0.8rem !important;
    margin-bottom: 10px !important;
  }
  
  .add-to-cart {
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
  }
  
  /* SECTION OPTIMIERUNGEN */
  .section-title {
    font-size: 1.6rem !important;
    margin-bottom: 20px !important;
    padding: 0 15px;
  }
  
  .featured-products {
    padding: 30px 0 !important;
  }
  
  /* FEATURES SEKTION */
  .features {
    padding: 30px 0 !important;
  }
  
  .feature-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 0 20px;
  }
  
  .feature {
    padding: 20px 15px !important;
  }
  
  .feature i {
    font-size: 2.5rem !important;
  }
  
  .feature h3 {
    font-size: 1.2rem !important;
  }
  
  /* FOOTER OPTIMIERUNG */
  footer {
    padding: 30px 0 15px !important;
  }
  
  .footer-content {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 0 15px;
    text-align: center;
  }
  
  .footer-section h3 {
    margin-bottom: 15px !important;
  }
  
  .footer-bottom {
    padding: 15px !important;
    font-size: 0.9rem;
  }
}

/* MODAL OPTIMIERUNGEN FÜR HANDY - KRITISCHE VERBESSERUNGEN */
@media screen and (max-width: 768px) {
  .modal {
    padding: 0 !important;
    align-items: flex-start !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  .modal-content {
    width: 100% !important;
    max-width: none !important;
    height: 100vh !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    padding: 25px 20px !important;
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  
  .modal h2 {
    font-size: 1.8rem !important;
    margin: 40px 0 25px !important;
    text-align: center;
    color: var(--primary-color);
  }
  
  .close-modal {
    position: fixed !important;
    top: 15px !important;
    right: 15px !important;
    font-size: 2.5rem !important;
    z-index: 1001 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    line-height: 1;
  }
  
  .form-group {
    margin-bottom: 20px !important;
  }
  
  .form-group label {
    font-size: 1.1rem !important;
    margin-bottom: 8px !important;
    font-weight: 600;
    color: var(--primary-color);
  }
  
  .form-group input {
    padding: 15px 12px !important;
    font-size: 16px !important; /* Verhindert Zoom auf iOS */
    border: 2px solid #ddd !important;
    border-radius: 8px !important;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: white;
  }
  
  .form-group input:focus {
    border-color: var(--secondary-color) !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.1);
  }
  
  .btn {
    width: 100% !important;
    padding: 15px 20px !important;
    font-size: 1.1rem !important;
    border-radius: 8px !important;
    margin-top: 10px;
    cursor: pointer;
    border: none;
  }
  
  /* LOGIN/REGISTER LINK STYLING */
  .modal-content p {
    text-align: center !important;
    margin-top: 20px !important;
    font-size: 1rem;
  }
  
  .modal-content a {
    color: var(--secondary-color) !important;
    font-weight: bold;
    text-decoration: none;
  }
  
  .modal-content a:hover {
    text-decoration: underline;
  }
}

/* EXTRA KLEINE BILDSCHIRME (< 480px) */
@media screen and (max-width: 480px) {
  /* NOCH KOMPAKTERES DESIGN */
  .logo {
    font-size: 1.5rem !important;
  }
  
  .user-actions a {
    font-size: 0.8rem !important;
    padding: 8px 12px !important;
  }
  
  .category-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding: 0 5px !important;
  }
  
  .category-card img {
    height: 100px !important;
  }
  
  .category-card h3 {
    font-size: 0.9rem !important;
    padding: 8px 5px !important;
  }
  
  .product-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding: 0 5px !important;
  }
  
  .product-card img {
    height: 120px !important;
  }
  
  .product-title {
    font-size: 0.85rem !important;
  }
  
  .product-price {
    font-size: 1rem !important;
  }
  
  .add-to-cart {
    font-size: 0.8rem !important;
    padding: 6px 8px !important;
  }
  
  .section-title {
    font-size: 1.4rem !important;
    padding: 0 10px;
  }
  
  /* MODAL WEITERE OPTIMIERUNGEN */
  .modal-content {
    padding: 20px 15px !important;
  }
  
  .modal h2 {
    font-size: 1.6rem !important;
    margin: 35px 0 20px !important;
  }
  
  .form-group input {
    padding: 12px 10px !important;
  }
  
  .close-modal {
    width: 45px !important;
    height: 45px !important;
    font-size: 2.2rem !important;
  }
}

/* LANDSCAPE MODE OPTIMIERUNGEN (Handy quer) */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .modal-content {
    height: 100vh !important;
    padding: 15px !important;
    justify-content: flex-start;
  }
  
  .modal h2 {
    margin: 20px 0 15px !important;
    font-size: 1.5rem !important;
  }
  
  .form-group {
    margin-bottom: 12px !important;
  }
  
  .form-group input {
    padding: 10px !important;
  }
  
  .close-modal {
    width: 40px !important;
    height: 40px !important;
    font-size: 2rem !important;
  }
}

/* TOUCH OPTIMIERUNGEN */
@media (hover: none) and (pointer: coarse) {
  /* Touch-friendly sizes */
  .category-card {
    min-height: 44px; /* Mindestgröße für Touch */
  }
  
  .product-card {
    min-height: 44px;
  }
  
  .add-to-cart {
    min-height: 44px !important;
    touch-action: manipulation;
  }
  
  .btn {
    min-height: 44px !important;
    touch-action: manipulation;
  }
  
  .close-modal {
    min-height: 44px !important;
    min-width: 44px !important;
    touch-action: manipulation;
  }
  
  /* Entferne Hover-Effekte bei Touch */
  .category-card:hover,
  .product-card:hover {
    transform: none;
  }
}

/* ACCESSIBILITY VERBESSERUNGEN */
@media screen and (max-width: 768px) {
  /* Bessere Lesbarkeit */
  body {
    font-size: 16px;
    line-height: 1.5;
  }
  
  /* Focus States */
  .form-group input:focus,
  .btn:focus,
  .close-modal:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
  }
  
  /* Scroll Improvements */
  .modal {
    scroll-behavior: smooth;
  }
  
  .modal-content {
    scroll-behavior: smooth;
  }
}

/* PERFORMANCE OPTIMIERUNGEN */
@media screen and (max-width: 768px) {
  /* Hardware-Beschleunigung für smoother Scrolling */
  .modal {
    transform: translateZ(0);
    will-change: scroll-position;
  }
  
  .modal-content {
    transform: translateZ(0);
    will-change: scroll-position;
  }
  
  /* Optimierte Animationen */
  .product-card,
  .category-card {
    transition: transform 0.2s ease-out;
  }
}

/* WEITERE UTILITY KLASSEN FÜR MOBILE */
@media screen and (max-width: 768px) {
  .mobile-hidden {
    display: none !important;
  }
  
  .mobile-center {
    text-align: center !important;
  }
  
  .mobile-full-width {
    width: 100% !important;
  }
  
  .mobile-padding {
    padding: 0 15px !important;
  }
}
