/* Base styles */
html {
     /* overflow-x: hidden; */
}
body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5;
    margin: 0;
    padding: 20px; /* Default padding */
    box-sizing: border-box;
    color: #333;
}

.container {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    text-align: center;
    max-width: 700px;
    width: 100%;
    margin-bottom: 30px;
    box-sizing: border-box;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 26px;
    letter-spacing: 0.05em;
}

.sub-headline {
     color: #888;
     font-size: 14px;
     margin-bottom: 30px;
}

label {
    display: block;
    margin-bottom: 10px;
    color: #555;
    font-weight: bold;
    text-align: left;
    font-size: 0.95em;
}

#text-input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 25px;
    border: 2px solid #eee;
    border-radius: 12px;
    box-sizing: border-box;
    font-size: 16px;
    transition: all 0.3s ease;
    text-align: left;
    background-color: #f9f9f9;
}

#text-input:focus {
    border-color: #007bff;
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
}

button {
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 50px; /* Pill shape */
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    
    /* Layout: block element, centered */
    display: block;
    margin: 0 auto 20px auto;
    
    width: 100%;
    max-width: 300px; /* Prevent oversizing on desktop */
    position: relative;
    overflow: hidden;
    min-width: 200px;
    box-sizing: border-box;
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Button press effect */
button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button#generate-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}
button#generate-btn:hover {
    background: linear-gradient(135deg, #0069d9 0%, #004494 100%);
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}
button#generate-btn:active {
    transform: translateY(1px);
}

#download-btn {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    display: none; /* Controlled via JS */
}
#download-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    box-shadow: 0 7px 14px rgba(40, 167, 69, 0.2), 0 3px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

/* QR code wrapper (border and padding) */
#qrcode-wrapper {
    display: inline-block;
    background-color: #fff;
    padding: 20px; /* White margin around QR code */
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    margin-top: 10px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

#qrcode-container {
    width: 256px; /* Overridden by JS */
    height: 256px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background-color: #fff;
}

#qrcode-container img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    /* Generation animation */
    animation: fadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.placeholder-text {
    color: #ccc;
    font-style: normal;
    font-size: 0.9em;
}

.privacy-notice {
    font-size: 0.8em;
    color: #999;
    margin-top: 15px;
    margin-bottom: 0;
}

.content-section {
    max-width: 700px;
    width: 100%;
    background-color: #ffffff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    text-align: left;
    line-height: 1.8;
    color: #444;
    box-sizing: border-box;
}

.content-section h2 {
    color: #333;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.4em;
}

 .content-section h3 {
    color: #007bff;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.1em;
 }

.content-section ul, .content-section ol {
    padding-left: 20px;
    margin-bottom: 20px;
}

.content-section li {
    margin-bottom: 10px;
}

footer {
    width: 100%;
    text-align: center;
    margin-top: auto;
    padding: 30px 0;
    font-size: 14px;
    color: #777;
    box-sizing: border-box;
}

.footer-nav {
    margin-top: 10px;
}

.footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px 25px;
}

.footer-nav a {
    color: #666;
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.2s;
}

.footer-nav a:hover {
    text-decoration: none;
    color: #007bff;
}

#download-link {
     display: none;
}

/* --- Mobile adjustments (screen width 767px and below) --- */
@media (max-width: 767px) {
    body {
        padding: 15px;
    }

    .container {
        padding: 30px 20px;
    }

    .content-section {
        padding: 30px 20px;
    }

    /* Tap-friendly button size */
    button {
        width: 100%;
        max-width: 300px;
        padding: 15px 20px;
        font-size: 16px;
    }

     #qrcode-container {
         width: 220px;
         height: 220px;
     }

    .footer-nav ul {
         gap: 10px 20px;
    }
}

/* --- Extra small screens (480px and below) --- */
@media (max-width: 480px) {
     body {
         padding: 10px;
     }
     .container {
         padding: 25px 15px;
     }
     h1 {
         font-size: 22px;
     }
     #text-input {
         font-size: 16px; /* Prevent iOS zoom */
     }

     /* QR code size adjustment */
     #qrcode-container {
         width: 180px;
         height: 180px;
     }
}

/* --- Modal (mobile save) styles --- */
.modal {
    display: flex;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    visibility: hidden; /* Hidden by default */
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none; /* Disable click events */
}

.modal.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto; /* Enable click events */
}

.modal-content {
    background-color: #fff;
    margin: 0 20px;
    padding: 30px 20px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 100%;
    max-width: 400px;
    position: relative;
    box-sizing: border-box;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: #333;
    text-decoration: none;
}

.modal-title {
    font-weight: bold;
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.modal-desc {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.modal-img-wrapper {
    margin-bottom: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    display: inline-block;
}

#mobile-save-img {
    max-width: 100%;
    height: auto;
    display: block;
}

#modal-close-btn {
    background: #6c757d;
    margin-bottom: 0;
}

#modal-close-btn:hover {
    background: #5a6268;
}
