/* ============================================= */
/* FARM FIRST - MOBILE UX OPTIMIZATIONS */
/* Marketing Command Center Mobile Styles */
/* ============================================= */

/* Field Mode Toggle Button (High Contrast Mode) */
#fieldModeToggle {
    position: fixed;
    bottom: 150px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--warning);
    border: 3px solid rgba(0,0,0,0.3);
    font-size: 1.5rem;
    z-index: 1000;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#fieldModeToggle:hover {
    transform: scale(1.1);
}

#fieldModeToggle.active {
    background: #FF6B35;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
}

/* Quick Post FAB */
#quickPostFab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--instagram);
    border: none;
    font-size: 1.5rem;
    z-index: 1000;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(225, 48, 108, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#quickPostFab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(225, 48, 108, 0.6);
}

#quickPostFab i {
    color: white;
}

/* Offline Indicator */
#offlineIndicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--danger), #ff6b6b);
    color: white;
    text-align: center;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#offlineIndicator.visible {
    display: flex;
}

#offlineIndicator i {
    animation: pulse-offline 2s infinite;
}

@keyframes pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Pending Posts Queue Indicator */
#pendingQueueIndicator {
    position: fixed;
    bottom: 220px;
    right: 20px;
    background: var(--info);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 999;
    display: none;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#pendingQueueIndicator.visible {
    display: flex;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(22, 33, 62, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 0.5rem;
    z-index: 999;
    justify-content: space-around;
    align-items: center;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.65rem;
    cursor: pointer;
    border-radius: 8px;
    min-height: 60px;
    min-width: 64px;
    transition: all 0.2s;
}

.mobile-nav-btn i {
    font-size: 1.25rem;
}

.mobile-nav-btn.active {
    color: var(--instagram);
    background: rgba(225, 48, 108, 0.15);
}

.mobile-nav-btn:hover {
    background: rgba(255,255,255,0.05);
}

/* ============================================= */
/* FIELD MODE - HIGH CONTRAST FOR SUNLIGHT */
/* ============================================= */
body.field-mode {
    background: #FFFFFF !important;
    color: #000000 !important;
}

body.field-mode .top-nav,
body.field-mode .tab-nav,
body.field-mode .access-banner {
    background: #FFFFFF !important;
    border-color: #000000 !important;
}

body.field-mode .nav-title,
body.field-mode .tab-btn,
body.field-mode .tab-btn.active {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    background: transparent !important;
}

body.field-mode .tab-btn.active {
    border-bottom-color: #1A5F2A !important;
}

body.field-mode .card,
body.field-mode .stat-card,
body.field-mode .field-mode-container {
    background: #FFFFFF !important;
    border: 2px solid #000000 !important;
    color: #000000 !important;
}

body.field-mode .stat-value,
body.field-mode .card-header h3,
body.field-mode h2, body.field-mode h3, body.field-mode h4 {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
}

body.field-mode .text-secondary,
body.field-mode .stat-label,
body.field-mode .nav-subtitle {
    color: #374151 !important;
}

body.field-mode .btn-primary,
body.field-mode .blast-btn,
body.field-mode .voice-note-btn {
    background: #1A5F2A !important;
    color: #FFFFFF !important;
    min-height: 72px !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
}

body.field-mode .btn-secondary,
body.field-mode .ai-caption-btn,
body.field-mode .schedule-toggle,
body.field-mode .draft-btn {
    background: #FFFFFF !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    min-height: 56px !important;
}

body.field-mode .caption-input {
    background: #FFFFFF !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    font-size: 18px !important;
}

body.field-mode .platform-toggle {
    background: #FFFFFF !important;
    border: 2px solid #374151 !important;
    min-height: 56px !important;
}

body.field-mode .platform-toggle.active {
    border-color: #1A5F2A !important;
    background: rgba(26, 95, 42, 0.1) !important;
}

body.field-mode .upload-zone {
    background: #FFFFFF !important;
    border: 3px dashed #000000 !important;
}

body.field-mode .upload-zone i {
    color: #1A5F2A !important;
}

body.field-mode #quickPostFab {
    background: #1A5F2A !important;
    width: 72px !important;
    height: 72px !important;
}

body.field-mode .mobile-bottom-nav {
    background: #FFFFFF !important;
    border-top: 2px solid #000000 !important;
}

body.field-mode .mobile-nav-btn {
    color: #000000 !important;
    min-height: 64px !important;
}

body.field-mode .mobile-nav-btn.active {
    background: rgba(26, 95, 42, 0.2) !important;
    color: #1A5F2A !important;
}

/* ============================================= */
/* MOBILE RESPONSIVE STYLES */
/* ============================================= */
@media (max-width: 768px) {
    /* Hide desktop sidebar/top navigation elements */
    .tab-nav {
        display: none !important;
    }

    /* Show mobile bottom nav */
    .mobile-bottom-nav {
        display: flex !important;
    }

    /* Adjust main content for bottom nav */
    .main-content {
        padding: 1rem;
        padding-bottom: 100px;
    }

    /* Larger buttons for gloved hands */
    .btn, .btn-primary, .btn-secondary {
        min-height: 56px;
        font-size: 1rem;
        padding: 1rem 1.5rem;
    }

    /* Larger caption input */
    .caption-input {
        font-size: 18px !important;
        min-height: 120px;
    }

    /* Voice note button - even larger on mobile */
    .voice-note-btn {
        min-height: 72px;
        font-size: 1.2rem;
    }

    /* Platform toggles larger */
    .platform-toggle {
        min-height: 56px;
        padding: 1rem;
    }

    /* Upload zone larger target */
    .upload-zone {
        min-height: 200px;
    }

    /* Hide access banner on mobile */
    .access-banner {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    /* Stack field mode content */
    .field-mode-content {
        grid-template-columns: 1fr;
    }

    /* Adjust FABs position for thumb zone */
    #quickPostFab {
        bottom: 90px;
        right: 16px;
    }

    #fieldModeToggle {
        bottom: 160px;
        right: 16px;
    }

    #pendingQueueIndicator {
        bottom: 230px;
        right: 16px;
    }

    /* AI caption buttons stack */
    .post-controls {
        flex-direction: column;
    }

    .post-controls > * {
        width: 100%;
        justify-content: center;
    }

    /* Stats grid responsive */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* Gallery grid */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    /* Even larger touch targets */
    .btn, .btn-primary, .btn-secondary {
        min-height: 64px;
    }

    .voice-note-btn {
        min-height: 80px;
    }

    /* Top nav compact */
    .top-nav {
        padding: 0.5rem 1rem;
    }

    .nav-title {
        font-size: 1rem;
    }

    .nav-actions {
        display: none;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-bottom-nav {
        padding: 0.25rem;
    }

    .mobile-nav-btn {
        min-height: 50px;
        flex-direction: row;
        gap: 0.5rem;
    }

    .mobile-nav-btn i {
        font-size: 1rem;
    }
}

/* ============================================= */
/* FIELD MODE CAPTURE SYSTEM */
/* Research-backed: 2-tap capture, 60px+ targets, voice-enabled */
/* ============================================= */

/* Field Capture FAB - The main entry point */
#fieldCaptureFab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    z-index: 1001;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-capture-fab 2s infinite;
}

#fieldCaptureFab i {
    color: white;
    font-size: 1.75rem;
}

#fieldCaptureFab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.7);
}

#fieldCaptureFab:active {
    transform: scale(0.95);
}

@keyframes pulse-capture-fab {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(34, 197, 94, 0.5);
    }
    50% {
        box-shadow: 0 4px 30px rgba(34, 197, 94, 0.7);
    }
}

/* Field Capture Overlay - Fullscreen capture experience */
#fieldCaptureOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    z-index: 10002;
    display: none;
    flex-direction: column;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#fieldCaptureOverlay.active {
    display: flex;
}

/* Header with close button */
.field-capture-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.3);
}

.field-capture-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #22c55e;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.field-capture-title i {
    font-size: 1.25rem;
}

.field-capture-close {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.field-capture-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Camera/Preview Zone */
.field-capture-camera-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    min-height: 250px;
}

.field-capture-preview {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    border-radius: 20px;
    border: 3px dashed rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.field-capture-preview:hover {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.field-capture-preview.has-image {
    border-style: solid;
    border-color: #22c55e;
}

.field-capture-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.field-capture-preview.has-image img {
    display: block;
}

.field-capture-preview-placeholder {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.field-capture-preview-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.4);
}

.field-capture-preview-placeholder p {
    font-size: 1.1rem;
    margin: 0;
}

.field-capture-preview.has-image .field-capture-preview-placeholder {
    display: none;
}

/* Main Action Buttons - 60px+ touch targets */
.field-capture-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 1rem 1.5rem;
}

.field-capture-btn {
    min-width: 140px;
    min-height: 64px;
    border-radius: 16px;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.field-capture-btn i {
    font-size: 1.3rem;
}

.field-capture-btn-voice {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
}

.field-capture-btn-voice:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.5);
}

.field-capture-btn-voice.recording {
    background: #e63946;
    animation: pulse-recording 1s infinite;
}

@keyframes pulse-recording {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.field-capture-btn-snap {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #052e16;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
    min-width: 160px;
}

.field-capture-btn-snap:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

/* Caption Section */
.field-capture-caption {
    padding: 0 1.5rem 1rem;
}

.field-capture-caption-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.field-capture-caption-label i {
    color: #22c55e;
}

.field-capture-caption-input {
    width: 100%;
    min-height: 80px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    color: white;
    font-size: 1rem;
    resize: none;
    font-family: inherit;
}

.field-capture-caption-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.field-capture-caption-input:focus {
    outline: none;
    border-color: #22c55e;
    background: rgba(255, 255, 255, 0.15);
}

/* Suggested Captions */
.field-capture-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.field-capture-suggestion {
    padding: 0.5rem 1rem;
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 20px;
    color: #22c55e;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.field-capture-suggestion:hover {
    background: rgba(34, 197, 94, 0.3);
    border-color: #22c55e;
}

/* Bottom Action Buttons - Queue & Skip */
.field-capture-submit {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.3);
}

.field-capture-queue-btn {
    flex: 2;
    min-height: 70px;
    border-radius: 16px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: #052e16;
    font-size: 1.25rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
    transition: all 0.2s;
}

.field-capture-queue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.5);
}

.field-capture-queue-btn:disabled {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: none;
    cursor: not-allowed;
}

.field-capture-queue-btn i {
    font-size: 1.5rem;
}

.field-capture-skip-btn {
    flex: 1;
    min-height: 70px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.field-capture-skip-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Success State Overlay */
.field-capture-success {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(34, 197, 94, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.field-capture-success.active {
    display: flex;
    animation: success-fade-in 0.3s ease-out;
}

@keyframes success-fade-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.field-capture-success-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    animation: success-check 0.5s ease-out 0.2s forwards;
    transform: scale(0);
}

@keyframes success-check {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.field-capture-success-icon i {
    font-size: 3rem;
    color: #22c55e;
}

.field-capture-success-text {
    color: white;
    text-align: center;
}

.field-capture-success-text h3 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
}

.field-capture-success-text p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

/* Undo Toast */
.field-capture-undo {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: none;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10003;
}

.field-capture-undo.active {
    display: flex;
    animation: slide-up-toast 0.3s ease-out;
}

@keyframes slide-up-toast {
    from { transform: translateX(-50%) translateY(100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.field-capture-undo-btn {
    padding: 0.5rem 1rem;
    background: #e63946;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.field-capture-undo-btn:hover {
    background: #dc2626;
}

/* High Contrast Field Mode Overrides */
body.field-mode #fieldCaptureOverlay {
    background: #FFFFFF !important;
}

body.field-mode .field-capture-header {
    background: #f1f5f9 !important;
}

body.field-mode .field-capture-title {
    color: #166534 !important;
}

body.field-mode .field-capture-close {
    background: #f1f5f9 !important;
    border-color: #000000 !important;
    color: #000000 !important;
}

body.field-mode .field-capture-preview {
    background: #f8fafc !important;
    border-color: #000000 !important;
}

body.field-mode .field-capture-preview-placeholder {
    color: #374151 !important;
}

body.field-mode .field-capture-preview-placeholder i {
    color: #166534 !important;
}

body.field-mode .field-capture-caption-label {
    color: #000000 !important;
}

body.field-mode .field-capture-caption-input {
    background: #f8fafc !important;
    border-color: #000000 !important;
    color: #000000 !important;
}

body.field-mode .field-capture-caption-input::placeholder {
    color: #6b7280 !important;
}

body.field-mode .field-capture-suggestion {
    background: rgba(22, 101, 52, 0.1) !important;
    border-color: #166534 !important;
    color: #166534 !important;
}

body.field-mode .field-capture-submit {
    background: #f1f5f9 !important;
}

body.field-mode .field-capture-queue-btn {
    min-height: 80px !important;
    font-size: 1.4rem !important;
}

body.field-mode .field-capture-skip-btn {
    background: #f8fafc !important;
    border-color: #000000 !important;
    color: #000000 !important;
    min-height: 80px !important;
}

body.field-mode #fieldCaptureFab {
    width: 80px !important;
    height: 80px !important;
}

body.field-mode #fieldCaptureFab i {
    font-size: 2rem !important;
}

/* Mobile Responsive for Field Capture */
@media (max-width: 768px) {
    #fieldCaptureFab {
        bottom: 100px;
        right: 16px;
    }

    .field-capture-preview {
        max-width: 100%;
        aspect-ratio: 4/3;
    }

    .field-capture-actions {
        flex-wrap: wrap;
    }

    .field-capture-btn {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .field-capture-header {
        padding: 0.75rem 1rem;
    }

    .field-capture-title {
        font-size: 1.25rem;
    }

    .field-capture-close {
        width: 44px;
        height: 44px;
    }

    .field-capture-caption {
        padding: 0 1rem 1rem;
    }

    .field-capture-submit {
        padding: 1rem;
    }
}
