/*
 * Black Flag - Mobile Styles
 * Separate mobile CSS to avoid conflicts with desktop
 * Only loaded on mobile devices
 */

/* Tablet View (Medium devices) */
@media (max-width: 1200px) {
    .container {
        padding: 16px;
    }
    
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
    }
}

/* Tablet View (Smaller tablets) */
@media (max-width: 1024px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    /* Hide tags panel on tablets too */
    .sidebar {
        display: none !important;
    }
    
    /* Full width main content */
    .main-content {
        width: 100%;
        max-width: 100%;
    }
    
    .filter-tags {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .main-nav {
        display: none;
    }
    
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
}

/* Mobile View (Large phones/Small tablets) */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    /* Hide tags panel on mobile */
    .sidebar {
        display: none !important;
    }
    
    /* Full width main content when sidebar is hidden */
    .main-content {
        width: 100%;
        max-width: 100%;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Mobile Header - Logo left, Hamburger right */
    .header {
        padding: 16px 0;
        margin-bottom: 16px;
    }
    
    .header-right {
        display: none !important;
    }
    
    .logo-text {
        font-size: 24px;
    }
    
    /* Hamburger Menu Button - moved to header visually via fixed positioning */
    .hamburger-menu {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: white;
        border: 2px solid rgba(46, 204, 113, 0.2);
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s ease;
        position: fixed;
        right: 20px;
        top: 28px;
        z-index: 1001;
        pointer-events: auto;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(46, 204, 113, 0.2);
    }
    
    .hamburger-menu:hover {
        background: rgba(46, 204, 113, 0.1);
        border-color: var(--primary);
    }
    
    .hamburger-menu.active {
        background: var(--primary);
        border-color: var(--primary);
    }
    
    .hamburger-icon {
        display: flex;
        flex-direction: column;
        gap: 4px;
        width: 20px;
    }
    
    .hamburger-icon span {
        display: block;
        width: 100%;
        height: 2px;
        background: #333;
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    
    .hamburger-menu.active .hamburger-icon span {
        background: white;
    }
    
    .hamburger-menu.active .hamburger-icon span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .hamburger-menu.active .hamburger-icon span:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger-menu.active .hamburger-icon span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
    
    /* Hide desktop navbar, show mobile menu */
    .floating-nav-bar {
        display: none;
    }
    
    /* Mobile Navigation Menu */
    .mobile-nav-menu {
        display: block;
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
        z-index: 999;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 70px 20px 20px;
    }
    
    .mobile-nav-menu.active {
        left: 0;
    }
    
    /* Mobile menu overlay */
    .mobile-nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .mobile-nav-overlay.active {
        display: block;
        opacity: 1;
    }
    
    /* Mobile Menu Header */
    .mobile-menu-header {
        padding: 0 0 16px;
        margin-bottom: 16px;
        border-bottom: 2px solid #f0f0f0;
    }
    
    .mobile-menu-user {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .mobile-menu-avatar {
        width: 48px;
        height: 48px;
        background: var(--primary);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: 600;
        font-size: 18px;
    }
    
    .mobile-menu-user-info {
        flex: 1;
    }
    
    .mobile-menu-username {
        font-weight: 600;
        font-size: 16px;
        color: #333;
        display: block;
        margin-bottom: 2px;
    }
    
    .mobile-menu-role {
        font-size: 13px;
        color: #666;
    }
    
    .mobile-menu-downloads {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
        background: #f8f9fa;
        border-radius: 10px;
        font-size: 14px;
        color: #333;
    }
    
    .mobile-menu-downloads svg {
        width: 16px;
        height: 16px;
        color: var(--primary);
    }
    
    /* Mobile Menu Section */
    .mobile-menu-section {
        margin-bottom: 24px;
    }
    
    .mobile-menu-section-title {
        font-size: 12px;
        font-weight: 600;
        color: #999;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 10px;
        padding: 0 4px;
    }
    
    /* Mobile Nav Item Wrapper */
    .mobile-nav-menu .nav-item-wrapper {
        position: relative;
        display: block;
        margin-bottom: 6px;
    }
    
    .mobile-nav-menu .nav-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 14px 18px;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 500;
        color: #333;
        background: #f8f9fa;
        border: none;
        text-align: left;
        cursor: pointer;
        transition: all 0.2s ease;
        text-decoration: none;
    }
    
    .mobile-nav-menu .nav-item:hover {
        background: rgba(46, 204, 113, 0.1);
        color: var(--primary);
    }
    
    .mobile-nav-menu .nav-item.active {
        background: var(--primary);
        color: white;
        box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
    }
    
    /* Mobile Dropdown Arrow */
    .mobile-nav-menu .dropdown-arrow {
        flex-shrink: 0;
        margin-left: 8px;
    }
    
    /* Mobile Subcategory Dropdown */
    .mobile-nav-menu .subcategory-dropdown {
        position: relative !important;
        margin-top: 8px;
        margin-left: 16px;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        z-index: 1;
        animation: none;
    }
    
    .mobile-nav-menu .subcategory-item {
        display: block;
        width: 100%;
        padding: 12px 18px;
        margin-bottom: 6px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 500;
        color: #666;
        background: #f0f0f0;
        border: none;
        text-align: left;
        cursor: pointer;
        transition: all 0.2s ease;
        text-decoration: none;
    }
    
    .mobile-nav-menu .subcategory-item:hover {
        background: rgba(46, 204, 113, 0.15);
        color: var(--primary);
    }
    
    /* Mobile Menu Actions */
    .mobile-menu-actions {
        margin-top: 20px;
        padding-top: 20px;
        border-top: 2px solid #f0f0f0;
    }
    
    .mobile-menu-action {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 18px;
        margin-bottom: 6px;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 500;
        color: #333;
        background: #f8f9fa;
        border: none;
        width: 100%;
        text-align: left;
        cursor: pointer;
        transition: all 0.2s ease;
        text-decoration: none;
    }
    
    .mobile-menu-action:hover {
        background: rgba(46, 204, 113, 0.1);
        color: var(--primary);
    }
    
    .mobile-menu-action svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
    
    .mobile-menu-action.logout {
        color: #dc3545;
    }
    
    .mobile-menu-action.logout:hover {
        background: rgba(220, 53, 69, 0.1);
        color: #dc3545;
    }
    
    .btn-language span {
        display: none;
    }
    
    .btn-language {
        padding: 10px 12px;
    }
    
    .downloads-badge {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .downloads-badge svg {
        width: 14px;
        height: 14px;
    }
    
    .footer {
        margin-top: 40px;
        padding: 30px 0;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 24px;
    }
    
    .footer-left,
    .footer-right {
        text-align: center;
    }
    
    .footer-links {
        gap: 20px;
    }
    
    .footer-social-support {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .footer-social-link,
    .footer-support-link {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .footer-logo {
        font-size: 20px;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-close {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .modal-title {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    .modal-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-action {
        width: 100%;
        justify-content: center;
    }
    
    .stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        font-size: 13px;
    }
    
    .header {
        gap: 12px;
        padding: 16px 0;
    }
    
    .header-right {
        gap: 6px;
    }
    
    .btn-rescan span,
    .btn-profile span {
        display: none;
    }
    
    .btn-rescan,
    .btn-profile {
        padding: 10px 12px;
        font-size: 0;
    }
    
    .btn-rescan svg,
    .btn-profile svg {
        margin: 0;
    }
    
    .template-media {
        height: 200px;
    }
    
    .template-info {
        padding: 16px;
    }
    
    .template-title {
        font-size: 14px;
    }
    
    .tag {
        font-size: 10px;
        padding: 5px 10px;
    }
    
    .search-bar {
        padding: 0 16px;
    }
    
    .search-bar input {
        font-size: 14px;
        padding: 12px 0;
    }
    
    .filter-title {
        font-size: 14px;
    }
    
    .filter-tag {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .sort-select {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .gallery-thumbnails {
        gap: 8px;
    }
    
    .gallery-thumb {
        width: 80px;
        height: 56px;
    }
}

/* Mobile View (Small phones) */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    /* Hide tags panel on mobile */
    .sidebar {
        display: none !important;
    }
    
    /* Full width main content */
    .main-content {
        width: 100%;
        max-width: 100%;
    }
    
    .logo-text {
        font-size: 20px;
    }
    
    .header {
        padding: 12px 0;
        gap: 8px;
    }
    
    /* Hamburger Menu - Smaller on small phones */
    .hamburger-menu {
        width: 40px !important;
        height: 40px !important;
        right: 12px !important;
        top: 24px !important;
    }
    
    .hamburger-icon {
        width: 18px;
        gap: 3px;
    }
    
    /* Mobile Navigation Menu - Narrower on small phones */
    .mobile-nav-menu {
        width: 260px;
        padding: 60px 16px 16px;
    }
    
    .mobile-menu-header {
        padding-bottom: 12px;
        margin-bottom: 12px;
    }
    
    .mobile-menu-avatar {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    
    .mobile-menu-username {
        font-size: 15px;
    }
    
    .mobile-menu-role {
        font-size: 12px;
    }
    
    .mobile-menu-downloads {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .mobile-menu-section {
        margin-bottom: 20px;
    }
    
    .mobile-nav-menu .nav-item {
        padding: 12px 16px;
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .mobile-nav-menu .subcategory-item {
        padding: 10px 16px;
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .mobile-menu-action {
        padding: 12px 16px;
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .downloads-badge {
        font-size: 11px;
        padding: 6px 10px;
        gap: 6px;
    }
    
    .downloads-badge svg {
        width: 12px;
        height: 12px;
    }
    
    .footer {
        margin-top: 30px;
        padding: 24px 0;
    }
    
    .footer-content {
        gap: 20px;
    }
    
    .footer-logo {
        font-size: 18px;
    }
    
    .footer-tagline {
        font-size: 12px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 12px;
    }
    
    .footer-link {
        font-size: 13px;
    }
    
    .footer-section-row {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .footer-projects {
        flex-wrap: wrap;
        justify-content: center;
        font-size: 12px;
    }
    
    .footer-social-support {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .footer-social-link,
    .footer-support-link {
        width: 100%;
        justify-content: center;
        font-size: 13px;
    }
    
    .footer-copyright {
        font-size: 11px;
    }
    
    .search-section {
        margin-bottom: 20px;
    }
    
    .search-bar {
        padding: 0 12px;
    }
    
    .search-bar input {
        font-size: 13px;
        padding: 10px 0;
    }
    
    .templates-grid {
        gap: 12px;
    }
    
    .template-media {
        height: 180px;
    }
    
    .template-info {
        padding: 12px;
    }
    
    .template-title {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .modal-content {
        padding: 16px;
        border-radius: 12px;
    }
    
    .modal-title {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .modal-video {
        margin-bottom: 16px;
    }
    
    .modal-tags {
        gap: 6px;
        margin-bottom: 16px;
    }
    
    .btn-action {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .dropdown-menu {
        min-width: 180px;
        right: -8px;
    }
    
    .dropdown-header {
        padding: 12px;
    }
    
    .dropdown-header strong {
        font-size: 13px;
    }
    
    .admin-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .dropdown-item {
        padding: 10px 12px;
        font-size: 13px;
        gap: 10px;
    }
    
    .gallery-nav {
        padding: 8px 16px;
        gap: 12px;
    }
    
    .gallery-counter {
        font-size: 12px;
        min-width: 50px;
    }
    
    .gallery-btn {
        width: 28px;
        height: 28px;
    }
    
    /* Discord Popup on Mobile */
    .discord-popup {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    
    .discord-popup-content {
        max-width: 100%;
        padding: 16px;
    }
    
    .discord-popup-icon {
        width: 40px;
        height: 40px;
    }
    
    .discord-popup-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .discord-popup-text h3 {
        font-size: 16px;
    }
    
    .discord-popup-text p {
        font-size: 13px;
    }
    
    .discord-popup-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Touch-friendly adjustments for mobile devices */
@media (hover: none) and (pointer: coarse) {
    .btn-rescan,
    .btn-settings,
    .btn-profile,
    .btn-action,
    .dropdown-item,
    .filter-tag,
    .nav-item {
        min-height: 44px;
    }
    
    .template-card {
        transition: none;
    }
    
    .template-card:active {
        transform: scale(0.98);
    }
}

