/* Mobile Fixes for attest.ink */

/* Footer mobile alignment fix */
@media (max-width: 768px) {
    .footer-content {
        text-align: left !important;
    }
    
    .footer-brand {
        text-align: left !important;
    }
    
    .footer-brand .logo {
        justify-content: flex-start !important;
    }
    
    .footer-links {
        text-align: left !important;
        justify-content: flex-start !important;
    }
    
    .footer-bottom {
        text-align: left !important;
        align-items: flex-start !important;
    }
    
    .footer-bottom p {
        text-align: left !important;
    }
}

/* Fix button consistency on mobile */
@media (max-width: 768px) {
    /* Ensure all buttons have consistent sizing */
    .btn,
    a.btn,
    button.btn,
    input[type="submit"].btn,
    input[type="button"].btn {
        font-size: 16px !important;
        padding: 14px 24px !important;
        min-height: 48px; /* Touch-friendly height */
        width: 100%;
        max-width: 100%;
        display: block;
        margin: 8px auto;
        text-align: center;
        box-sizing: border-box;
    }
    
    /* Button containers should stack vertically */
    .button-group,
    .attest-modal-buttons,
    .text-center {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    /* Inline buttons in specific contexts */
    .modal-buttons-inline {
        flex-direction: row;
        gap: 8px;
    }
    
    .modal-buttons-inline .btn {
        flex: 1;
        margin: 0;
    }
}

/* Fix modal close button positioning on mobile */
@media (max-width: 600px) {
    .attest-modal-content {
        width: calc(100% - 20px) !important;
        margin: 10px !important;
        max-height: calc(100vh - 20px) !important;
        border-radius: 8px !important;
    }
    
    .attest-modal-header {
        padding: 16px !important;
        position: relative;
    }
    
    .attest-modal-close {
        position: absolute !important;
        right: 12px !important;
        top: 12px !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 28px !important;
        margin: 0 !important;
        background: var(--bg-secondary) !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 1;
    }
    
    .attest-modal-body {
        padding: 20px 16px !important;
        max-height: calc(100vh - 120px) !important;
    }
    
    .attest-modal-title {
        font-size: 20px !important;
        padding-right: 50px; /* Space for close button */
    }
    
    .attest-modal-message {
        font-size: 16px !important;
    }
    
    .attest-modal-buttons {
        margin-top: 20px !important;
        width: 100%;
    }
}

/* Fix footer on mobile */
@media (max-width: 768px) {
    footer {
        padding: 24px 16px !important;
        margin-top: 40px;
    }
    
    .footer-content {
        gap: 32px !important;
    }
    
    .footer-brand .logo {
        margin-bottom: 12px;
    }
    
    .footer-brand p {
        font-size: 16px !important;
        line-height: 1.5;
    }
    
    .footer-links {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px !important;
        width: 100%;
        text-align: center;
    }
    
    .footer-links a {
        font-size: 16px !important;
        padding: 8px;
        display: block;
    }
    
    .footer-bottom {
        gap: 16px !important;
        padding-top: 20px;
        border-top: 1px solid var(--border-color);
        margin-top: 20px;
    }
    
    .footer-bottom p {
        font-size: 14px !important;
        text-align: center;
    }
    
    .footer-bottom .badge-legacy {
        display: inline-block !important;
        margin-top: 8px;
    }
}

/* Fix specific modal buttons */
@media (max-width: 600px) {
    /* Share modal buttons */
    #share-options .btn {
        width: 100% !important;
        margin: 8px 0 !important;
    }
    
    /* Create/Result page buttons */
    .button-group.modal-buttons-inline {
        display: flex;
        flex-direction: row;
        gap: 8px;
        margin-top: 16px;
    }
    
    .button-group.modal-buttons-inline .btn {
        flex: 1;
        padding: 12px 16px !important;
        font-size: 14px !important;
    }
    
    /* Verify page buttons */
    #verify-buttons .btn {
        width: 100% !important;
        margin: 8px 0 !important;
    }
}

/* Fix specific issues on create/verify pages */
@media (max-width: 768px) {
    /* Result container buttons */
    .result-container .btn,
    .verify-container .btn {
        width: 100% !important;
        max-width: none !important;
        margin: 8px 0 !important;
    }
    
    /* Copy/Download button row */
    .copy-download-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
    }
    
    .copy-download-buttons .btn {
        width: 100% !important;
        margin: 0 !important;
    }
}

/* Ensure proper stacking context */
.attest-modal-overlay {
    z-index: 10000 !important;
}

.attest-modal-content {
    z-index: 10001 !important;
}

/* Fix badge display in footer */
@media (max-width: 480px) {
    .footer-bottom {
        flex-direction: column !important;
    }
    
    .footer-bottom > * {
        width: 100%;
        text-align: center !important;
    }
    
    .badge-legacy {
        margin: 12px auto !important;
        display: inline-block !important;
    }
}

/* Ensure theme toggle doesn't interfere with modals */
.theme-toggle {
    z-index: 999 !important; /* Below modals */
}

/* Fix overflow issues */
body.modal-open {
    overflow: hidden;
}

/* Additional button fixes for very small screens */
@media (max-width: 380px) {
    .btn,
    a.btn {
        font-size: 14px !important;
        padding: 12px 16px !important;
    }
    
    .attest-modal-buttons {
        flex-direction: column !important;
    }
    
    .attest-modal-buttons .btn {
        width: 100% !important;
        margin: 4px 0 !important;
    }
}