/* Mobile Responsive Styles for KittyCoin Platform */

/* Mobile First Approach */
@media (max-width: 768px) {
    /* Header Navigation */
    .mobile-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        transition: left 0.3s ease;
        z-index: 1000;
        padding: 2rem;
        overflow-y: auto;
    }

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

    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .mobile-nav-overlay.active {
        display: block;
    }

    /* Hamburger Menu */
    .hamburger {
        display: block;
        cursor: pointer;
        z-index: 1001;
    }

    .hamburger span {
        display: block;
        width: 25px;
        height: 3px;
        background: white;
        margin: 5px 0;
        transition: 0.3s;
        border-radius: 2px;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    /* Hide desktop nav on mobile */
    .desktop-nav {
        display: none;
    }

    /* Reduce padding and margins */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Hero Section */
    .hero h2 {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero p {
        font-size: 1rem;
    }

    /* Stats Grid - Stack vertically on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stats-card {
        padding: 1rem;
    }

    .stats-card .text-3xl {
        font-size: 1.5rem;
    }

    /* Coin Cards - Single column */
    .coin-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Table Responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive table {
        min-width: 600px;
    }

    .table-responsive th,
    .table-responsive td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    /* Trading Section - Stack vertically */
    .trading-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .trading-panel {
        order: -1; /* Move trading panel to top on mobile */
    }

    /* Chart containers */
    .chart-container {
        height: 300px;
    }

    .donut-chart-container {
        height: 200px;
    }

    /* Forms */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-input {
        padding: 0.75rem;
        font-size: 1rem;
    }

    /* Buttons */
    .btn-mobile {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .btn-group-mobile {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-group-mobile > * {
        flex: none;
        width: 100%;
    }

    /* Quick amount buttons */
    .quick-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    /* Comment System */
    .comment-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .comment-avatar {
        width: 2rem;
        height: 2rem;
    }

    /* Portfolio Cards */
    .portfolio-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .portfolio-charts {
        grid-template-columns: 1fr;
    }

    /* Modal Adjustments */
    .modal-mobile {
        margin: 1rem;
        width: calc(100% - 2rem);
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }

    /* Search and Filter */
    .search-filter-mobile {
        flex-direction: column;
        gap: 1rem;
    }

    .search-input-mobile {
        width: 100%;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        text-align: center;
    }

    .footer-links {
        font-size: 0.875rem;
    }

    /* Pagination */
    .pagination-mobile {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .pagination-mobile button {
        min-width: 2.5rem;
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}

/* Tablet Responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet specific styles */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .coin-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .trading-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 350px;
    }
}

/* Touch Interactions */
@media (hover: none) {
    /* Remove hover effects on touch devices */
    .coin-card:hover,
    .portfolio-card:hover,
    .comment-card:hover {
        transform: none;
        box-shadow: none;
    }

    /* Increase tap targets */
    button,
    .btn,
    .clickable {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover states */
    *:hover {
        background-color: inherit !important;
        color: inherit !important;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 2rem 0;
    }

    .hero h2 {
        font-size: 1.75rem;
    }

    .chart-container {
        height: 250px;
    }
}

/* Very Small Screens */
@media (max-width: 480px) {
    .hero h2 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.875rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats-card .text-3xl {
        font-size: 1.25rem;
    }

    .portfolio-summary {
        grid-template-columns: 1fr;
    }

    .table-responsive th,
    .table-responsive td {
        padding: 0.25rem;
        font-size: 0.75rem;
    }

    .chart-container,
    .donut-chart-container {
        height: 200px;
    }
}

/* Utility Classes for Mobile */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }

    .show-mobile.flex {
        display: flex !important;
    }

    .show-mobile.grid {
        display: grid !important;
    }
}

/* Swipe Gestures for Charts */
.swipeable {
    touch-action: pan-y;
}

.swipeable canvas {
    touch-action: manipulation;
}

/* Improved Touch Scrolling */
.scroll-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Loading States for Mobile */
.loading-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 2rem;
}

.loading-mobile i {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States for Mobile */
.error-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 2rem;
    text-align: center;
}

.error-mobile i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ef4444;
}

/* Mobile Specific Components */
.mobile-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f3f4f6;
}

/* Pull to Refresh Indicator */
.pull-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    transform: translateY(-100px);
    transition: transform 0.3s ease;
}

.pull-refresh.active {
    transform: translateY(0);
}

.pull-refresh i {
    margin-right: 0.5rem;
    animation: spin 1s linear infinite;
}