/**
 * ZYNE Community Mobile Enhancements  
 * Optimizes social interaction for mobile community engagement
 * 
 * Perfect for mobile community posting, reactions, and social discovery
 */

@media (max-width: 768px) {
    
    /* ============================================
       MOBILE LAYOUT OPTIMIZATION
       ============================================ */
    
    .container {
        padding: 20px 15px !important;
        max-width: 100% !important;
    }
    
    /* ============================================
       MOBILE HEADER SECTION
       ============================================ */
    
    header {
        margin-bottom: 25px !important;
        padding-bottom: 20px !important;
    }
    
    .logo {
        font-size: 2.5em !important;
        letter-spacing: 2px !important;
        margin-bottom: 8px !important;
    }
    
    .tagline {
        font-size: 0.9em !important;
        margin-bottom: 12px !important;
        padding: 0 10px;
    }
    
    .description {
        font-size: 0.85em !important;
        padding: 0 15px;
    }
    
    /* ============================================
       MOBILE POST GRID
       ============================================ */
    
    .posts {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-bottom: 40px !important;
    }
    
    .post {
        padding: 16px !important;
        border-radius: 8px !important;
        border: 1px solid #222 !important;
        background: #111 !important;
        max-height: none !important;
        overflow: visible !important;
        transition: all 0.3s ease;
        position: relative;
        margin-bottom: 8px;
    }
    
    .post:active {
        transform: scale(0.98);
        border-color: #4ecdc4;
        background: #1a1a1a;
    }
    
    /* Remove hover effects on mobile */
    .post:hover {
        transform: none !important;
        box-shadow: none !important;
        z-index: auto !important;
        max-height: none !important;
        border-color: #222 !important;
        background: #111 !important;
    }
    
    /* ============================================
       MOBILE POST CONTENT
       ============================================ */
    
    .post-content {
        font-size: 0.95em !important;
        line-height: 1.6 !important;
        color: #e8e8e8 !important;
        margin-bottom: 12px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .post-content p {
        margin-bottom: 8px;
    }
    
    .post-content p:last-child {
        margin-bottom: 0;
    }
    
    /* ============================================
       MOBILE POST METADATA
       ============================================ */
    
    .post-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #222;
        font-size: 0.8em;
        color: #888;
    }
    
    .post-signature {
        font-weight: 500;
        color: #4ecdc4;
        flex: 1;
        min-width: 0; /* Allow text truncation */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .post-timestamp {
        color: #666;
        font-size: 0.75em;
        margin-left: 10px;
        flex-shrink: 0;
    }
    
    /* ============================================
       MOBILE REACTIONS SECTION
       ============================================ */
    
    .post-reactions {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 10px;
        padding: 8px 0;
        border-top: 1px solid #1a1a1a;
    }
    
    .reaction-buttons {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .reaction-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 8px !important;
        font-size: 1.2em !important;
        border-radius: 8px !important;
        background: rgba(255,255,255,0.05) !important;
        border: 1px solid #333 !important;
        color: #ccc !important;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }
    
    .reaction-btn:active {
        transform: scale(0.9);
        background: rgba(78, 205, 196, 0.2) !important;
        border-color: #4ecdc4 !important;
    }
    
    .reaction-btn.active {
        background: rgba(78, 205, 196, 0.15) !important;
        border-color: #4ecdc4 !important;
        color: #4ecdc4 !important;
    }
    
    .reaction-count {
        font-size: 0.75em;
        color: #888;
        margin-left: 4px;
        font-weight: 500;
    }
    
    .reaction-count.active {
        color: #4ecdc4;
    }
    
    /* ============================================
       MOBILE POST CREATION FORM & MODAL FIXES
       ============================================ */
    
    /* Fix the cramped desktop modal for mobile */
    .modal {
        padding: 10px !important;
        align-items: flex-start !important;
        padding-top: 50px !important;
    }
    
    .modal-content {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: none !important;
        max-height: calc(100vh - 100px) !important;
        margin: 0 auto;
        padding: 25px !important;
        border-radius: 12px !important;
        background: #0a0a0a !important;
        border: 1px solid #222 !important;
    }
    
    /* Post form container (if it exists) */
    .post-form-container {
        background: #0a0a0a !important;
        border: 1px solid #222 !important;
        border-radius: 12px !important;
        padding: 20px !important;
        margin-bottom: 30px;
        position: sticky;
        top: 20px;
        z-index: 100;
    }
    
    .form-title {
        font-size: 1.2em !important;
        color: #fff !important;
        font-weight: 600;
        margin-bottom: 15px;
        text-align: center;
    }
    
    .post-form {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    .form-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .form-label {
        font-size: 0.9em;
        color: #ccc;
        font-weight: 500;
    }
    
    .form-input,
    .form-textarea {
        width: 100% !important;
        padding: 12px 16px !important;
        font-size: 16px !important; /* Prevent iOS zoom */
        border: 2px solid #333 !important;
        border-radius: 10px !important;
        background: #222 !important;
        color: #fff !important;
        font-family: inherit;
        transition: border-color 0.3s ease;
    }
    
    .form-textarea {
        min-height: 120px !important;
        resize: vertical;
        line-height: 1.5;
    }
    
    /* Override the desktop modal textarea specifically */
    .modal .form-group textarea {
        min-height: 150px !important;
        padding: 16px !important;
        font-size: 16px !important;
        border: 2px solid #333 !important;
        border-radius: 10px !important;
        background: #222 !important;
        color: #fff !important;
        line-height: 1.6 !important;
        font-family: inherit !important;
    }
    
    .modal .form-group textarea:focus {
        border-color: #4ecdc4 !important;
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2) !important;
    }
    
    /* Better modal form inputs */
    .modal .form-group input {
        min-height: 48px !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
        border: 2px solid #333 !important;
        border-radius: 10px !important;
        background: #222 !important;
        color: #fff !important;
    }
    
    .modal .form-group input:focus {
        border-color: #4ecdc4 !important;
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2) !important;
    }
    
    .form-input:focus,
    .form-textarea:focus {
        border-color: #4ecdc4 !important;
        outline: none;
        box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2);
    }
    
    .form-input::placeholder,
    .form-textarea::placeholder {
        color: #666;
        font-style: italic;
    }
    
    /* Character counter */
    .char-counter {
        font-size: 0.8em;
        color: #888;
        text-align: right;
        margin-top: 4px;
    }
    
    .char-counter.warning {
        color: #ffc107;
    }
    
    .char-counter.error {
        color: #ff6b6b;
    }
    
    /* ============================================
       MOBILE SIGNATURE SELECTOR
       ============================================ */
    
    .signature-selector {
        margin: 12px 0;
    }
    
    .signature-options {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin-top: 12px;
    }
    
    .signature-option {
        min-height: 48px !important;
        padding: 12px 10px !important;
        font-size: 0.9em !important;
        border-radius: 8px !important;
        background: #333 !important;
        color: #ccc !important;
        border: 1px solid #444 !important;
        cursor: pointer;
        transition: all 0.3s ease;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 500;
        touch-action: manipulation;
    }
    
    .signature-option.active {
        background: rgba(78, 205, 196, 0.2) !important;
        color: #4ecdc4 !important;
        border-color: #4ecdc4 !important;
    }
    
    .signature-option:active {
        transform: scale(0.95);
    }
    
    /* ============================================
       MOBILE SUBMIT BUTTON
       ============================================ */
    
    /* Mobile submit button improvements */
    .submit-btn, .modal .btn-primary {
        width: 100% !important;
        min-height: 52px !important;
        background: linear-gradient(135deg, #4ecdc4 0%, #44b3a8 100%) !important;
        color: #000 !important;
        border: none !important;
        border-radius: 12px !important;
        font-size: 1.1em !important;
        font-weight: 600 !important;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
        margin-top: 15px;
        touch-action: manipulation;
    }
    
    .submit-btn:active, .modal .btn-primary:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(78, 205, 196, 0.4);
    }
    
    /* Improve the floating publish button */
    .publish-section {
        position: fixed !important;
        bottom: 25px !important;
        right: 25px !important;
        z-index: 1000;
    }
    
    .publish-link {
        width: 64px !important;
        height: 64px !important;
        font-size: 28px !important;
        background: linear-gradient(135deg, #4ecdc4 0%, #44b3a8 100%) !important;
        color: #000 !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-decoration: none !important;
        box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4) !important;
        transition: all 0.3s ease !important;
        font-weight: bold !important;
        touch-action: manipulation;
    }
    
    .publish-link:active {
        transform: scale(0.9);
        box-shadow: 0 4px 15px rgba(78, 205, 196, 0.5) !important;
    }
    
    /* Improve modal button layout */
    .modal .button-group {
        flex-direction: column !important;
        gap: 12px !important;
        margin-top: 20px;
    }
    
    .modal .btn-secondary {
        min-height: 48px !important;
        background: #333 !important;
        color: #ccc !important;
        border: 1px solid #444 !important;
        border-radius: 10px !important;
        font-size: 1em !important;
        padding: 12px 20px !important;
        touch-action: manipulation;
    }
    
    .modal .btn-secondary:active {
        background: #444 !important;
        transform: scale(0.98);
    }
    
    /* Keyboard behavior improvements */
    body.keyboard-open .modal {
        padding-top: 20px !important;
    }
    
    body.keyboard-open .modal-content {
        max-height: calc(100vh - 40px) !important;
    }
    
    body.keyboard-open .publish-section {
        display: none !important;
    }
    
    /* Hide non-essential elements when modal is open */
    body.modal-open .posts,
    body.modal-open header,
    body.modal-open .back-link {
        filter: blur(2px);
        opacity: 0.3;
        pointer-events: none;
    }
}
    
    .submit-btn:disabled {
        background: #333 !important;
        color: #666 !important;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }
    
    .submit-icon {
        font-size: 1.2em;
    }
    
    /* Submission states */
    .submitting .submit-icon {
        animation: spin 1s linear infinite;
    }
    
    @keyframes spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }
    
    /* ============================================
       MOBILE STATUS MESSAGES
       ============================================ */
    
    .status-message {
        padding: 12px 16px !important;
        border-radius: 10px !important;
        font-size: 0.9em !important;
        text-align: center;
        margin-bottom: 15px;
        font-weight: 500;
        border: 1px solid transparent;
    }
    
    .status-success {
        background: rgba(78, 205, 196, 0.1) !important;
        color: #4ecdc4 !important;
        border-color: #4ecdc4 !important;
    }
    
    .status-error {
        background: rgba(255, 107, 107, 0.1) !important;
        color: #ff6b6b !important;
        border-color: #ff4444 !important;
    }
    
    .status-info {
        background: rgba(102, 126, 234, 0.1) !important;
        color: #667eea !important;
        border-color: #667eea !important;
    }
    
    /* ============================================
       MOBILE LOADING STATES
       ============================================ */
    
    .loading-posts {
        text-align: center;
        padding: 40px 20px;
        color: #888;
        font-size: 0.9em;
    }
    
    .loading-spinner {
        display: inline-block;
        width: 20px;
        height: 20px;
        border: 2px solid #333;
        border-radius: 50%;
        border-top-color: #4ecdc4;
        animation: spin 1s linear infinite;
        margin-right: 8px;
    }
    
    /* ============================================
       MOBILE EMPTY STATE
       ============================================ */
    
    .empty-state {
        text-align: center;
        padding: 60px 20px;
        color: #666;
    }
    
    .empty-icon {
        font-size: 3em;
        margin-bottom: 15px;
        opacity: 0.5;
    }
    
    .empty-title {
        font-size: 1.2em;
        color: #888;
        margin-bottom: 8px;
        font-weight: 500;
    }
    
    .empty-subtitle {
        font-size: 0.9em;
        color: #666;
        line-height: 1.5;
    }
    
    /* ============================================
       MOBILE PULL TO REFRESH
       ============================================ */
    
    .pull-to-refresh {
        position: fixed;
        top: -60px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(78, 205, 196, 0.9);
        color: #000;
        padding: 10px 20px;
        border-radius: 20px;
        font-size: 0.85em;
        font-weight: 600;
        transition: top 0.3s ease;
        z-index: 1000;
    }
    
    .pull-to-refresh.visible {
        top: 20px;
    }
    
    /* ============================================
       MOBILE NAVIGATION INTEGRATION
       ============================================ */
    
    .site-nav {
        position: sticky;
        top: 0;
        background: rgba(0,0,0,0.95) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        z-index: 99;
        margin-bottom: 15px;
    }
    
    /* ============================================
       MOBILE KEYBOARD OPTIMIZATIONS
       ============================================ */
    
    /* Ensure form doesn't get covered by keyboard */
    .form-textarea:focus,
    .form-input:focus {
        scroll-margin-top: 20px;
        scroll-margin-bottom: 120px;
    }
    
    /* iOS keyboard handling */
    body.keyboard-open .post-form-container {
        position: relative !important;
        top: auto !important;
    }
    
    body.keyboard-open .posts {
        display: none !important;
    }
    
    /* ============================================
       MOBILE UTILITY CLASSES
       ============================================ */
    
    .mobile-hidden { display: none !important; }
    .mobile-only { display: block !important; }
    .mobile-center { text-align: center !important; }
    .mobile-full-width { width: 100% !important; }
    .mobile-no-gap { gap: 0 !important; }
    .mobile-small-text { font-size: 0.8em !important; }
    
    /* ============================================
       MOBILE ACCESSIBILITY ENHANCEMENTS
       ============================================ */
    
    /* Enhanced touch targets */
    .reaction-btn,
    .signature-option,
    .submit-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        touch-action: manipulation;
    }
    
    /* Better focus indicators */
    .form-input:focus,
    .form-textarea:focus,
    .signature-option:focus,
    .submit-btn:focus {
        box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.5) !important;
    }
    
    /* Improved contrast for mobile screens */
    .post-content {
        color: #f0f0f0 !important;
    }
    
    .post-signature {
        color: #5ef0e6 !important; /* Brighter for mobile visibility */
    }
}