/* ============================================
   KOMPLETTE MOBILE OPTIMIERUNG
   für EVD Aktuell - Alle Seiten
   ============================================ */

/* ============================================
   BASE & VIEWPORT
   ============================================ */

* {
    -webkit-tap-highlight-color: rgba(204, 0, 0, 0.3);
    -webkit-touch-callout: none;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   TABLET (max-width: 1024px)
   ============================================ */

@media (max-width: 1024px) {
    /* Navigation */
    .nav-menu {
        flex-direction: column;
        gap: 10px;
    }

    .nav-link {
        padding: 12px 20px;
        font-size: 1rem;
    }

    /* Container */
    .container {
        padding: 0 20px;
    }

    /* Content Sections */
    .content-section {
        padding: 40px 20px;
    }

    /* Grid Layouts */
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   MOBILE (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {

    /* ===== TYPOGRAPHY ===== */
    h1 {
        font-size: 2rem !important;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.5rem !important;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    p {
        font-size: 1rem;
        line-height: 1.6;
    }

    /* ===== NAVIGATION ===== */
    .global-nav {
        height: 60px;
        padding: 0 15px;
    }

    .nav-brand {
        font-size: 1.2rem;
    }

    .nav-brand img {
        height: 35px;
    }

    .nav-toggle {
        display: flex !important;
        width: 40px;
        height: 40px;
        background: rgba(204, 0, 0, 0.2);
        border: 2px solid rgba(204, 0, 0, 0.4);
        border-radius: 8px;
        color: #fff;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        z-index: 1001;
    }

    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 20px;
        gap: 0;
        transition: left 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-link {
        width: 100%;
        padding: 18px 20px;
        border-bottom: 1px solid rgba(204, 0, 0, 0.2);
        font-size: 1.1rem;
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .nav-link i {
        font-size: 1.3rem;
        width: 30px;
    }

    .nav-link:hover,
    .nav-link.active {
        background: rgba(204, 0, 0, 0.15);
        border-left: 4px solid #cc0000;
        padding-left: 16px;
    }

    /* ===== HERO SECTION ===== */
    .hero-section {
        padding: 100px 20px 60px;
        min-height: auto;
    }

    .hero-content {
        text-align: center;
        max-width: 100%;
    }

    .hero-title {
        font-size: 2.5rem !important;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .hero-image {
        max-width: 250px;
        margin: 30px auto 0;
    }

    /* ===== BUTTONS ===== */
    .btn,
    .btn-primary,
    .btn-secondary {
        padding: 14px 24px;
        font-size: 1rem;
        min-height: 48px;
        width: 100%;
        justify-content: center;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    /* ===== CARDS ===== */
    .card {
        margin-bottom: 20px;
    }

    .card-content {
        padding: 20px;
    }

    .card-title {
        font-size: 1.3rem;
    }

    .card-text {
        font-size: 0.95rem;
    }

    /* ===== GRIDS ===== */
    .grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    /* ===== BLOG LIST ===== */
    .blog-item {
        flex-direction: column;
    }

    .blog-image {
        width: 100%;
        height: 200px;
        border-radius: 12px 12px 0 0;
    }

    .blog-content {
        padding: 20px;
    }

    /* ===== FORMS ===== */
    .form-group {
        margin-bottom: 20px;
    }

    input,
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px 15px;
        min-height: 48px;
    }

    textarea {
        min-height: 120px;
    }

    /* ===== ADMIN PANEL ===== */
    .admin-container {
        padding: 15px;
    }

    .admin-header {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .admin-header h1 {
        font-size: 1.5rem !important;
    }

    .admin-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .admin-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        min-width: 140px;
        white-space: nowrap;
        font-size: 0.95rem;
        padding: 12px 20px;
    }

    .admin-content {
        padding: 15px;
    }

    /* ===== MODALS ===== */
    .modal-content {
        width: 95%;
        max-width: 500px;
        margin: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-body {
        padding: 20px 15px;
    }

    /* ===== TABLES ===== */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    th,
    td {
        padding: 10px;
        font-size: 0.9rem;
    }

    /* ===== FOOTER ===== */
    .footer {
        padding: 40px 20px 20px;
    }

    .footer-content {
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }

    .footer-section {
        width: 100%;
    }

    /* ===== SPACING ===== */
    .section {
        padding: 40px 20px;
    }

    .container {
        padding: 0 20px;
    }

    /* ===== IMAGES ===== */
    img {
        max-width: 100%;
        height: auto;
    }

    .img-responsive {
        width: 100%;
        height: auto;
    }
}

/* ============================================
   SMALL MOBILE (max-width: 480px)
   ============================================ */

@media (max-width: 480px) {

    /* Extra kleine Optimierungen */
    h1 {
        font-size: 1.8rem !important;
    }

    h2 {
        font-size: 1.3rem !important;
    }

    .hero-title {
        font-size: 2rem !important;
    }

    .nav-brand {
        font-size: 1rem;
    }

    .nav-brand img {
        height: 30px;
    }

    .nav-link {
        padding: 15px;
        font-size: 1rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .card-content {
        padding: 15px;
    }

    .modal-content {
        width: 98%;
        margin: 10px;
    }
}

/* ============================================
   TOUCH & GESTURES
   ============================================ */

@media (hover: none) and (pointer: coarse) {

    /* Größere Touch-Targets */
    a,
    button,
    .clickable {
        min-height: 44px;
        min-width: 44px;
    }

    /* Active States für Touch-Feedback */
    button:active,
    .btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }

    a:active {
        opacity: 0.7;
    }

    /* Hover-States deaktivieren */
    *:hover {
        /* Keine Hover-Effekte auf Touch */
    }

    /* Focus States für Touch */
    input:focus,
    textarea:focus,
    select:focus {
        outline: 3px solid rgba(204, 0, 0, 0.5);
        outline-offset: 2px;
    }
}

/* ============================================
   LANDSCAPE MODE
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding: 80px 20px 40px;
    }

    .nav-menu {
        height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .modal-content {
        max-height: 85vh;
    }
}

/* ============================================
   ADMIN PANEL MOBILE SPECIFIC
   ============================================ */

@media (max-width: 768px) {

    /* Sidebar Navigation → Bottom Tab Bar */
    .admin-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(20px);
        border-top: 2px solid rgba(204, 0, 0, 0.3);
        border-radius: 0;
        padding: 0;
        z-index: 100;
    }

    .admin-nav {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
    }

    .nav-item {
        flex: 1;
        padding: 12px 8px;
        flex-direction: column;
        gap: 5px;
        font-size: 0.75rem;
        border-radius: 0;
        border-left: none;
        border-top: 3px solid transparent;
    }

    .nav-item.active,
    .nav-item:hover {
        border-left: none;
        border-top-color: #cc0000;
        background: rgba(204, 0, 0, 0.15);
    }

    .nav-item i {
        font-size: 1.3rem;
    }

    .nav-item span {
        font-size: 0.7rem;
    }

    /* Main Content Adjustment */
    .admin-main {
        margin-left: 0;
        margin-bottom: 70px; /* Space for bottom nav */
        width: 100%;
    }

    /* Login Screen */
    .login-container {
        padding: 20px;
    }

    .login-box {
        padding: 30px 20px;
    }

    /* Dashboard Cards */
    .dashboard-stats {
        grid-template-columns: 1fr !important;
    }

    .stat-card {
        padding: 20px;
    }

    /* Action Buttons */
    .actions-bar {
        flex-direction: column;
        gap: 10px;
    }

    .actions-bar .btn {
        width: 100%;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    .btn,
    .card,
    .nav-link {
        border-width: 3px;
    }

    input,
    textarea,
    select {
        border-width: 2px;
    }
}

/* ============================================
   PWA & STANDALONE MODE
   ============================================ */

@media (display-mode: standalone) {
    .global-nav {
        padding-top: env(safe-area-inset-top);
    }

    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Hide on Mobile */
.hide-mobile {
    display: none !important;
}

@media (min-width: 769px) {
    .hide-mobile {
        display: block !important;
    }

    .hide-desktop {
        display: none !important;
    }
}

/* Show only on Mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }

    .show-desktop {
        display: none !important;
    }
}

/* Text Alignment on Mobile */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }

    .text-left-mobile {
        text-align: left !important;
    }
}

/* Full Width on Mobile */
@media (max-width: 768px) {
    .full-width-mobile {
        width: 100% !important;
    }
}
