/* ============================================
   CryptoBot Pro - Responsive Styles
   Mobile First Approach
   ============================================ */

/* ============================================
   Extra Large Screens (1400px+)
   ============================================ */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .bot-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   Large Screens (1200px - 1399px)
   ============================================ */
@media (max-width: 1399px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

/* ============================================
   Medium-Large Screens (992px - 1199px)
   ============================================ */
@media (max-width: 1199px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .page-content {
        padding: 1.5rem;
    }
    
    .header {
        padding: 0 1.5rem;
    }
}

/* ============================================
   Tablet Landscape (768px - 991px)
   ============================================ */
@media (max-width: 991px) {
    /* Sidebar - Collapsible */
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    /* Main content - Full width */
    .main-content {
        margin-left: 0;
    }
    
    /* Show menu toggle */
    .menu-toggle {
        display: flex;
    }
    
    /* Header adjustments */
    .header {
        padding: 0 1rem;
    }
    
    .user-info {
        display: none;
    }
    
    /* Stats grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Bot grid */
    .bot-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Tables - Horizontal scroll */
    .table-container {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    /* Cards */
    .card-body {
        padding: 1.25rem;
    }
    
    /* Modal */
    .modal {
        max-width: 90%;
        margin: 1rem;
    }
}

/* ============================================
   Tablet Portrait (576px - 767px)
   ============================================ */
@media (max-width: 767px) {
    /* Page content */
    .page-content {
        padding: 1rem;
    }
    
    /* Header */
    .header {
        height: 60px;
    }
    
    .page-title h1 {
        font-size: 1rem;
    }
    
    .page-title p {
        display: none;
    }
    
    /* Stats grid - Single column on small tablets */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Stat card */
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-info h3 {
        font-size: 1.25rem;
    }
    
    /* Bot grid - Single column */
    .bot-grid {
        grid-template-columns: 1fr;
    }
    
    /* Wallet card */
    .wallet-card {
        padding: 1.5rem;
        min-height: 180px;
    }
    
    .wallet-balance .amount {
        font-size: 2rem;
    }
    
    /* Auth card */
    .auth-card {
        padding: 1.5rem;
        max-width: 100%;
    }
    
    /* Table - Stacked on mobile */
    .table-responsive-stack thead {
        display: none;
    }
    
    .table-responsive-stack tbody tr {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .table-responsive-stack tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border: none;
    }
    
    .table-responsive-stack tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
    }
    
    /* Buttons in row */
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group-mobile .btn {
        width: 100%;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
    }
    
    .pagination-item {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    /* Alerts */
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
}

/* ============================================
   Mobile (max-width: 575px)
   ============================================ */
@media (max-width: 575px) {
    /* Typography */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
    h4 { font-size: 1rem; }
    
    /* Container padding */
    .page-content {
        padding: 0.75rem;
    }
    
    /* Header */
    .header {
        padding: 0 0.75rem;
    }
    
    /* Wallet Balance Badge - Mobile */
    .wallet-balance-badge {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .wallet-balance-badge .balance-amount {
        font-size: 0.8rem;
    }
    
    .theme-toggle {
        width: 36px;
        height: 36px;
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    /* Cards */
    .card {
        border-radius: var(--radius);
    }
    
    .card-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-footer {
        padding: 0.875rem 1rem;
    }
    
    /* Stat card */
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    
    /* Wallet card */
    .wallet-card {
        padding: 1.25rem;
        min-height: 160px;
        border-radius: var(--radius-lg);
    }
    
    .wallet-balance .amount {
        font-size: 1.75rem;
    }
    
    .wallet-id {
        font-size: 0.75rem;
    }
    
    /* Auth card */
    .auth-container {
        padding: 1rem;
    }
    
    .auth-card {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
    }
    
    .auth-logo h1 {
        font-size: 1.5rem;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        padding: 0.625rem 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .input-group .form-control {
        padding-left: 2.5rem;
    }
    
    .input-group .input-icon {
        left: 0.875rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: 0.875rem 1.5rem;
    }
    
    /* Bot cards */
    .bot-card-header {
        padding: 1.25rem;
    }
    
    .bot-card-header .price {
        font-size: 1.75rem;
    }
    
    .bot-card-body {
        padding: 1.25rem;
    }
    
    /* Modal */
    .modal {
        max-width: 100%;
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.875rem 1rem;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Toast */
    .toast-container {
        left: 0.5rem;
        right: 0.5rem;
        top: auto;
        bottom: 0.5rem;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
    
    /* Sidebar */
    .sidebar {
        width: 280px;
    }
    
    .sidebar-header {
        padding: 1.25rem;
    }
    
    .menu-item {
        padding: 0.625rem 1.25rem;
    }
    
    /* Dashboard grid adjustments */
    .dashboard-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Flex utilities for mobile */
    .flex-mobile-column {
        flex-direction: column;
    }
    
    .gap-mobile-2 {
        gap: 0.5rem;
    }
    
    /* Hide on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* Transaction history */
    .transaction-item {
        padding: 0.875rem;
    }
    
    .transaction-amount {
        font-size: 1rem;
    }
}

/* ============================================
   Extra Small Mobile (max-width: 375px)
   ============================================ */
@media (max-width: 375px) {
    .page-content {
        padding: 0.5rem;
    }
    
    .card-body,
    .card-header,
    .card-footer {
        padding: 0.875rem;
    }
    
    .wallet-card {
        padding: 1rem;
    }
    
    .wallet-balance .amount {
        font-size: 1.5rem;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        margin-bottom: 0.5rem;
    }
}

/* ============================================
   Landscape Mode Adjustments
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .auth-container {
        padding: 1rem;
    }
    
    .auth-card {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal {
        max-height: 95vh;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .sidebar,
    .header,
    .menu-toggle,
    .theme-toggle,
    .btn,
    .pagination,
    .modal-backdrop {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .page-content {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    a {
        color: black !important;
        text-decoration: underline !important;
    }
    
    .wallet-card {
        background: #f0f0f0 !important;
        color: black !important;
    }
}

/* ============================================
   Touch Device Optimizations
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
    }
    
    .form-control {
        min-height: 44px;
    }
    
    .menu-item {
        min-height: 44px;
    }
    
    .pagination-item {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Remove hover effects on touch */
    .card:hover,
    .stat-card:hover,
    .bot-card:hover {
        transform: none;
    }
    
    /* Add active states instead */
    .btn:active {
        transform: scale(0.98);
    }
    
    .menu-item:active {
        background: var(--bg-tertiary);
    }
}

/* ============================================
   High DPI / Retina Displays
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Thinner borders */
    .card,
    .form-control,
    .btn-outline {
        border-width: 0.5px;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .auth-container::before {
        animation: none;
    }
}

/* ============================================
   Dark Mode + Mobile Specific
   ============================================ */
@media (max-width: 767px) {
    [data-theme="dark"] .sidebar {
        border-right: none;
    }
    
    [data-theme="dark"] .sidebar-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
}

/* ============================================
   Notification Dropdown Responsive
   ============================================ */
@media (max-width: 576px) {
    .notification-dropdown .notification-menu {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .notification-list {
        max-height: 60vh;
    }
    
    .notification-toggle {
        width: 36px;
        height: 36px;
    }
    
    .notification-toggle i {
        font-size: 1rem;
    }
    
    .notification-badge {
        min-width: 16px;
        height: 16px;
        font-size: 0.6rem;
    }
}
