/* Mobile CSS для SatoshiFi Dashboard */

/* MetaMask Mobile Notice */
.metamask-mobile-notice {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f7931a;
    color: white;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.metamask-mobile-notice button {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

/* Mobile device detection and adjustments */
@media (max-width: 768px) {

    /* Show MetaMask notice on mobile */
    .mobile-device .metamask-mobile-notice {
        display: block;
    }

    /* Adjust app when notice is shown */
    .mobile-device.with-mobile-notice #app {
        padding-top: 44px;
    }

    /* App structure adjustments */
    #app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    }

    /* Header adjustments */
    .app-header {
        flex-shrink: 0;
        padding: 8px 0;
        border-bottom: 1px solid var(--satoshi-border);
    }

    .app-header .container {
        padding: 0 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        height: auto;
    }

    .header-brand h1 {
        font-size: 18px;
        margin: 0;
    }

    .version {
        font-size: 10px;
        padding: 2px 6px;
    }

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

    /* Wallet section adjustments */
    .header-wallet {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .account-info {
        flex-direction: column;
        gap: 4px;
        align-items: flex-end;
    }

    .account-details {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
    }

    .account-address {
        font-size: 11px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .account-balance {
        font-size: 10px;
    }

    .account-avatar {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
        min-height: 36px;
    }

    /* Main content structure */
    .app-main {
        flex: 1;
        padding: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .app-main .container {
        height: 100%;
        display: flex;
        flex-direction: column;
        max-width: none;
        padding: 0;
        margin: 0;
        gap: 0;
    }

    /* Sidebar - convert to bottom navigation */
    .app-sidebar {
        order: 2;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        background: var(--satoshi-white);
        border-top: 1px solid var(--satoshi-border);
        border-radius: 0;
        padding: 8px;
        z-index: 1000;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    }

    /* Hide user profile on mobile */
    .user-profile {
        display: none;
    }

    /* Bottom navigation layout */
    .sidebar-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        gap: 0;
        margin: 0;
    }

    .nav-item {
        flex: 1;
        text-align: center;
        margin: 0;
    }

    .sidebar-nav .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 8px 4px;
        gap: 4px;
        border-radius: 8px;
        font-size: 11px;
        text-decoration: none;
        color: var(--satoshi-dark-gray);
        border: none;
        background: none;
        transition: all 0.2s ease;
        min-height: 50px;
        justify-content: center;
    }

    .sidebar-nav .nav-link:hover {
        background: var(--satoshi-gray);
        transform: none;
    }

    .sidebar-nav .nav-link.active {
        background: var(--satoshi-orange);
        color: var(--satoshi-white);
        border-color: var(--satoshi-orange);
    }

    .nav-icon {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .nav-text {
        font-size: 9px;
        line-height: 1.2;
        font-weight: 500;
    }

    /* Content area */
    .app-content {
        flex: 1;
        order: 1;
        margin-bottom: 70px;
        padding: 16px;
        overflow-y: auto;
        background: var(--satoshi-white);
        -webkit-overflow-scrolling: touch;
    }

    /* Section headers */
    .section-header {
        padding: 16px 0;
        margin-bottom: 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .section-header h2 {
        font-size: 24px;
        margin: 0;
    }

    .section-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Dashboard grid */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Widgets */
    .widget {
        padding: 16px;
        border-radius: 8px;
        margin-bottom: 12px;
    }

    .widget-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .widget-stats {
        gap: 12px;
    }

    /* Stats cards */
    .overview-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 11px;
    }

    /* Tabs */
    .tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 16px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        padding: 12px 16px;
        font-size: 14px;
        white-space: nowrap;
        min-width: auto;
    }

    /* Forms */
    .form-input,
    .form-select,
    .form-textarea {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    /* Search and filters */
    .search-controls {
        flex-direction: column;
        gap: 12px;
    }

    .filters {
        flex-direction: column;
        gap: 8px;
    }

    .pools-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    /* Pool and NFT grids */
    .pools-grid,
    .nft-grid,
    .roles-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Pool cards */
    .pool-card {
        padding: 16px;
    }

    .pool-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .pool-actions {
        flex-direction: column;
        gap: 8px;
    }

    /* Activity list */
    .activity-item {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .activity-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    /* Request cards */
    .request-card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .request-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .request-actions {
        flex-direction: column;
        gap: 8px;
    }

    /* Request tabs */
    .request-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
    }

    .request-tab-btn {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Tables - convert to cards */
    .table {
        display: none;
    }

    .pools-table {
        display: block;
    }

    .table-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 16px;
        border: 1px solid var(--satoshi-border);
        border-radius: 8px;
        margin-bottom: 12px;
        background: var(--satoshi-white);
    }

    .table-header {
        display: none;
    }

    /* Empty states */
    .empty-state {
        padding: 32px 16px;
    }

    .empty-icon {
        font-size: 48px;
    }

    /* Modals */
    .modal-content {
        margin: 20px;
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }

    .modal-header {
        padding: 16px;
        flex-wrap: wrap;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-actions {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
    }

    /* Notifications */
    .notification {
        margin: 8px;
        max-width: calc(100vw - 16px);
    }

    /* Loading states */
    .loading-spinner {
        width: 32px;
        height: 32px;
    }

    /* Status badges */
    .status-badge,
    .role-badge {
        padding: 4px 8px;
        font-size: 11px;
    }

    /* View controls - hide on mobile */
    .view-controls {
        display: none;
    }

    /* Charts and complex elements */
    .mining-chart-container {
        padding: 16px;
    }

    #hashrateChart {
    height: 250px;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .app-content {
        margin-bottom: 60px;
    }

    .app-sidebar {
        height: 60px;
        padding: 6px;
    }

    .sidebar-nav .nav-link {
        padding: 6px 4px;
        min-height: 48px;
    }

    .nav-icon {
        font-size: 16px;
    }

    .nav-text {
        font-size: 8px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .app-header .container {
        padding: 0 8px;
    }

    .header-brand h1 {
        font-size: 16px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .app-content {
        padding: 12px;
    }

    .section-header {
        padding: 12px 0;
    }

    .section-header h2 {
        font-size: 20px;
    }

    .widget {
        padding: 12px;
    }

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

    .stat-card {
        padding: 12px;
    }

    .nav-text {
        font-size: 8px;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .nav-link:hover,
    .btn:hover,
    .card:hover,
    .widget:hover {
        transform: none;
        box-shadow: none;
    }

    /* Better touch targets */
    button,
    .btn,
    .nav-link,
    .tab-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Prevent zoom on inputs */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    /* Better scrolling */
    .app-content,
    .modal-content {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* Safe area support for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        .mobile-device.with-mobile-notice #app {
            padding-top: calc(44px + env(safe-area-inset-top));
        }

        .app-sidebar {
            padding-bottom: calc(8px + env(safe-area-inset-bottom));
        }

        .app-content {
            margin-bottom: calc(70px + env(safe-area-inset-bottom));
        }
    }
}
