/* Message Mender™ Styles */

/* Custom CSS Variables */
:root {
    --bg-color: #FFFFFF;
    --text-color: #222222;
    --primary-button: #2F3E4D;
    --accent-button: #F4D35E;
    --accent-hover: #F2C94C;
    --secondary-button: #F3C9C1;
    --hover-color: #1a252f;
    --border-color: #e0e0e0;
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Base Styles */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 2rem;
    margin: 0;
    font-size: 16px;
    max-width: 800px;
    margin: 0 auto;
}

/* Main Content Container */
.main-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem 2rem 0.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Tablets and Desktop */
@media (min-width: 768px) and (max-width: 1023px) {
    .form-container {
        max-width: 700px;
        margin: auto;
    }

    .message-input {
        font-size: 1.1rem;
    }

    .form-select {
        font-size: 1.05rem;
    }

    .mend-button {
        width: auto;
        padding: 0.75rem 2rem;
        font-size: 1.05rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .form-container {
        max-width: 900px;
        margin: auto;
    }

    .message-input {
        font-size: 1.2rem;
    }

    .form-select {
        font-size: 1.1rem;
    }

    .mend-button {
        width: auto;
        padding: 0.75rem 2rem;
        font-size: 1.1rem;
    }
}

/* Touch-friendly enhancements for all mobile devices */
@media (max-width: 1023px) {
    /* Ensure all interactive elements meet minimum touch target size */
    .form-select,
    .message-input,
    .mend-button,
    .tone-button {
        min-height: 44px; /* iOS guidelines */
        touch-action: manipulation;
    }
    
    /* Improve form accessibility */
    .form-label {
        cursor: pointer;
    }
    
    /* Better tap targets */
    .copy-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Prevent horizontal scrolling */
    .container-fluid {
        overflow-x: hidden;
    }
    
    /* Optimize for landscape orientation */
    @media (orientation: landscape) and (max-height: 500px) {
        body {
            padding: 0.5rem;
        }
        
        .message-input {
            min-height: 100px;
        }
        
        .form-label {
            margin-bottom: 0.3rem !important;
        }
        
        .optional-tone {
            margin-top: 0.5rem !important;
        }
    }
}
    
    .tone-training-section {
        width: 100%;
    }
    
    .tone-upload-container {
        width: 100%;
        max-width: 100%;
    }
    
    .tone-training-content .form-control {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        border: 1px solid #ccc;
        border-radius: 8px;
        padding: 1rem;
        font-size: 1rem;
        font-family: 'Inter', sans-serif;
    }
}

@media (min-width: 1200px) {
    .main-content {
        padding: 1rem 3rem 0.5rem !important;
    }
}

@media (min-width: 1400px) {
    .main-content {
        padding: 1rem 4rem 0.5rem !important;
    }
}

/* Optimized spacing between sections */
.mb-2 {
    margin-bottom: 1.25rem !important;
}

/* Desktop section spacing */
@media (min-width: 768px) {
    .mb-2 {
        margin-bottom: 2rem !important;
    }
}

/* Header Styles */
.app-header {
    margin-bottom: 1rem;
    padding: 12px 0 6px;
}

/* Desktop header adjustments */
@media (min-width: 768px) {
    .app-header {
        padding: 16px 0 24px;
        margin-bottom: 1.5rem;
    }
}

.logo-container {
    margin-bottom: 0.1rem;
}

.main-logo {
    max-width: 600px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Form Styles */
.input-section {
    margin-bottom: 1.5rem;
    margin-top: 0.5rem;
}

/* Desktop input section adjustments */
@media (min-width: 768px) {
    .input-section {
        margin-bottom: 2rem;
        margin-top: 0.5rem;
    }
}

.form-label {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.25rem;
    font-size: 1rem;
    line-height: 1.4;
    font-family: 'Inter', sans-serif;
    display: block;
}

.message-input {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 1rem;
    font-size: 1.1rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 150px;
    transition: border-color 0.2s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

.message-input:focus {
    border: 3px solid #9ca3af;
    box-shadow: none;
    outline: none;
}

.message-input::placeholder {
    color: #999;
    font-size: 16px;
    font-weight: 400;
}

.form-select {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    font-family: 'Inter', sans-serif;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-select:focus {
    border: 3px solid #9ca3af !important;
    box-shadow: none !important;
    outline: none !important;
}

.form-control:focus {
    border: 3px solid #9ca3af !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Button Styles */
.mend-button {
    background-color: var(--accent-button);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #2F3E4D;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.02em;
    margin-top: 1.25rem;
    font-family: 'Inter', sans-serif;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.mend-button:hover:not(:disabled) {
    background-color: #F2C94C;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 211, 94, 0.4);
    color: #2F3E4D;
    filter: brightness(1.05);
}

.mend-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Optional Tone Section */
.optional-tone {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.optional-tone label {
    margin: 0;
    flex: 1;
    min-width: 180px;
}

.tone-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.tone-privacy-icon {
    color: #F4D35E;
    font-size: 0.9rem;
    cursor: help;
}

.tone-button {
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tone-button:hover {
    background-color: #e9ecef;
}

.btn-secondary {
    background-color: #6c757d;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

/* Results Section */
.results-section {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.original-message-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-light);
}

.original-message-card .card-body {
    padding: 1.5rem;
}

.result-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.result-card .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 1.5rem;
    border-radius: 10px 10px 0 0;
}

.result-card .card-body {
    padding: 1.5rem;
}

.result-title {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.2;
    margin: 0;
    display: flex;
    align-items: center;
}

.copy-btn {
    border: 1px solid var(--primary-button);
    color: var(--primary-button);
    border-radius: 6px;
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background-color: var(--primary-button);
    color: white;
    transform: scale(1.05);
}

.copy-btn.copied {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

/* Alert Styles */
.alert {
    border: none;
    border-radius: 8px;
    margin-bottom: 2rem;
}

/* Tone Training Section */
.tone-training-section {
    padding-bottom: 0.5rem;
}

/* Usage Tracker Styles */
.usage-tracker {
    margin-top: 0.75rem;
}

.usage-indicator {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    background-color: #e8f5e8;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.usage-tracker.limit-reached .usage-indicator {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.usage-tracker.active .usage-indicator {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

/* Referral Modal Styles */
.referral-link-container .input-group input {
    font-family: monospace;
    font-size: 0.9rem;
}

/* Pro Modal Styles */
.pro-modal .modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.pro-modal-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.pro-modal-subtitle {
    font-size: 1rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.pro-email-input {
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.pro-email-input:focus {
    border: 3px solid #9ca3af !important;
    box-shadow: none !important;
    outline: none !important;
}

.pro-unlock-btn {
    background-color: var(--accent-button);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #2F3E4D;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.pro-unlock-btn:hover:not(:disabled) {
    background-color: #F2C94C;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 211, 94, 0.4);
    color: #2F3E4D;
}

.pro-unlock-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Footer Email Capture */
.footer-email-capture {
    text-align: center;
    padding: 0.5rem 0;
    border-top: 1px solid #e1e5e9;
    margin-top: 1rem;
}

/* Referral Button Styles */
.referral-btn {
    border: 1px solid var(--primary-button);
    color: var(--primary-button);
    background: transparent;
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    font-weight: 500;
}

.referral-btn:hover {
    background-color: var(--primary-button);
    color: white;
    border-color: var(--primary-button);
    transform: translateY(-1px);
}

.referral-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(47, 62, 77, 0.25);
    outline: none;
}

/* Toast improvements */
.toast {
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-header {
    border-bottom: none;
    font-weight: 600;
}

/* Visual Credit System */
#mend-credits {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0.5rem 0;
    cursor: help;
}

/* Tone Training Toggle Button */
#toggleToneTraining {
    color: #6c757d;
    border-color: #6c757d;
    transition: all 0.2s ease;
}

#toggleToneTraining:hover {
    color: #17a2b8;
    border-color: #17a2b8;
    background-color: rgba(23, 162, 184, 0.1);
}

.flavicon {
    width: 28px;
    height: 28px;
    transition: all 0.3s ease;
    cursor: help;
}

.flavicon.used {
    filter: grayscale(100%);
    opacity: 0.4;
    transform: scale(0.85);
}

.flavicon:not(.used) {
    /* No shadow - clean appearance */
}

.usage-tracker {
    text-align: center;
}

.credit-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Bonus credit styling */
.flavicon.bonus {
    border: 2px solid #4CAF50;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.1);
}

/* Submit button disabled state */
.btn-secondary.disabled,
.btn-secondary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Pro Coming Soon Page */
.pro-coming-soon-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pro-content {
    flex: 1;
    padding: 2rem 0;
}

.pro-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.pro-subtitle {
    font-size: 1.2rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.pro-features {
    max-width: 800px;
    margin: 0 auto;
}

.pro-feature {
    padding: 1.5rem;
    text-align: center;
}

.pro-feature i {
    font-size: 2rem;
    color: var(--accent-button);
    display: block;
    margin-bottom: 1rem;
}

.pro-feature h5 {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.pro-feature p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

.pro-status {
    max-width: 600px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .pro-title {
        font-size: 2rem;
    }
    
    .pro-subtitle {
        font-size: 1.1rem;
    }
    
    .pro-feature {
        padding: 1rem;
    }
}

/* Footer positioning */
footer {
    margin-top: auto;
    padding: 0.75rem 0 !important;
    font-size: 0.85rem !important;
}

/* Loading Animation */
.fa-spin {
    animation: fa-spin 1s infinite linear;
}

/* Mobile and Tablet Responsive Design */

/* Small phones (320px - 480px) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
        padding: 0.75rem;
    }

    .form-container {
        max-width: 100%;
        padding: 0;
    }

    .message-input {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 120px;
        padding: 0.75rem;
    }

    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }

    .form-label {
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.4rem !important;
    }

    .optional-tone {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.4rem !important;
        flex-wrap: nowrap !important;
    }

    .optional-tone label {
        font-size: 0.85rem !important;
        margin: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }

    .tone-controls {
        gap: 0.3rem !important;
    }

    .tone-privacy-icon {
        font-size: 0.7rem !important;
    }

    .tone-button {
        font-size: 0.75rem !important;
        padding: 0.35rem 0.7rem !important;
        white-space: nowrap;
    }

    .form-label .fas.fa-question-circle {
        font-size: 0.65rem !important;
        margin-left: 0.2rem !important;
    }

    .mend-button {
        font-size: 0.95rem !important;
        padding: 0.75rem 1.5rem !important;
    }

    /* Very small screens */
    @media (max-width: 320px) {
        .form-label {
            font-size: 0.8rem !important;
        }
        
        .optional-tone label {
            font-size: 0.8rem !important;
        }
        
        .tone-controls {
            gap: 0.25rem !important;
        }

        .tone-privacy-icon {
            font-size: 0.6rem !important;
        }

        .tone-button {
            font-size: 0.7rem !important;
            padding: 0.3rem 0.6rem !important;
        }
    }
}

/* Medium phones (481px - 600px) */
@media (min-width: 481px) and (max-width: 600px) {
    body {
        font-size: 15px;
        padding: 1rem;
    }

    .form-container {
        max-width: 100%;
    }

    .message-input {
        font-size: 16px;
        min-height: 130px;
    }

    .form-select {
        font-size: 16px;
    }

    .form-label {
        font-size: 0.9rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.5rem !important;
    }

    .optional-tone {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.5rem !important;
        flex-wrap: nowrap !important;
    }

    .optional-tone label {
        font-size: 0.9rem !important;
        margin: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }

    .tone-controls {
        gap: 0.4rem !important;
    }

    .tone-privacy-icon {
        font-size: 0.75rem !important;
    }

    .tone-button {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.8rem !important;
        white-space: nowrap;
    }

    .form-label .fas.fa-question-circle {
        font-size: 0.7rem !important;
        margin-left: 0.25rem !important;
    }
}

/* Large phones and small tablets (601px - 767px) */
@media (min-width: 601px) and (max-width: 767px) {
    body {
        font-size: 16px;
        padding: 1.5rem;
    }

    .form-container {
        max-width: 600px;
        margin: 0 auto;
    }

    .message-input {
        font-size: 1.05rem;
        min-height: 140px;
    }

    .form-select {
        font-size: 1.05rem;
    }

    .form-label {
        font-size: 1rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.6rem !important;
    }

    .optional-tone {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.6rem !important;
        flex-wrap: nowrap !important;
    }

    .optional-tone label {
        font-size: 1rem !important;
        margin: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }

    .tone-controls {
        gap: 0.5rem !important;
    }

    .tone-privacy-icon {
        font-size: 0.8rem !important;
    }

    .tone-button {
        font-size: 0.9rem !important;
        padding: 0.5rem 1rem !important;
        white-space: nowrap;
    }

    .form-label .fas.fa-question-circle {
        font-size: 0.8rem !important;
        margin-left: 0.3rem !important;
    }

    .mend-button {
        font-size: 1.1rem !important;
        padding: 0.9rem 2rem !important;
    }
}
    
    .app-header {
        margin-bottom: 0.5rem;
        padding: 12px 0 6px;
    }
    
    .main-logo {
        max-width: 360px;
    }
    
    .mb-2 {
        margin-bottom: 1rem !important;
    }
    
    .form-control, .form-select {
        padding: 0.65rem;
        font-size: 1rem;
    }
    
    .mend-button {
        padding: 12px 24px;
        font-size: 1rem;
        margin-top: 1rem;
        width: 100%;
    }
    
    .result-card .card-header,
    .result-card .card-body,
    .original-message-card .card-body {
        padding: 1rem;
    }
}

/* Extra small devices - extreme gap reduction */
@media (max-width: 376px) {
    .main-content {
        padding: 0.125rem 0.5rem 0.25rem !important;
    }
    
    .app-header {
        margin-bottom: 0.125rem;
        padding: 2px 0 0px;
    }
    
    .main-logo {
        max-width: 200px;
    }
}

/* Very small devices - reduce gap significantly */
@media (max-width: 480px) {
    .main-content {
        padding: 0.25rem 0.5rem 0.25rem !important;
    }
    
    .app-header {
        margin-bottom: 0.25rem;
        padding: 4px 0 0px;
    }
    
    .main-logo {
        max-width: 220px;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 0.5rem 0.5rem 0.25rem !important;
    }
    
    .app-header {
        margin-bottom: 0.25rem;
        padding: 8px 0 4px;
    }
    
    .main-logo {
        max-width: 250px;
    }
    
    .mb-2 {
        margin-bottom: 0.75rem !important;
    }
    
    .form-label {
        margin-bottom: 0.25rem;
        font-size: 0.85rem;
    }
    
    .message-input {
        min-height: 90px;
        padding: 0.65rem;
        font-size: 0.95rem;
    }
    
    .mend-button {
        padding: 10px 20px;
        font-size: 0.95rem;
        margin-top: 0.75rem;
    }
    
    footer {
        padding: 0.25rem 0 !important;
        font-size: 0.75rem !important;
    }
    
    .mend-button {
        padding: 12px 18px;
        font-size: 0.95rem;
        margin-top: 1rem;
    }
    
    .tone-training-section {
        padding-bottom: 1rem;
    }
    
    .copy-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
}
    
    .result-card .card-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start !important;
    }
    
    .copy-btn {
        align-self: flex-end;
    }
}

/* Tone Training Section */
.tone-training-section {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.tone-training-content {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screenshot-upload input[type="file"] {
    border: 2px dashed var(--border-color);
    background-color: white;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.screenshot-upload input[type="file"]:hover {
    border-color: var(--primary-button);
    background-color: #f8f9fa;
}

.extracted-text-section {
    margin-top: 1rem;
}

.extracted-messages .form-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
}

.tone-example-text {
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

/* Pro CTA Styling */
.btn-outline-secondary.disabled {
    color: #6c757d;
    border-color: #6c757d;
    opacity: 0.6;
}

/* Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-button);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-color: #000000;
        --primary-button: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* Force cache bust */
