/* Reset and Base Styles */
*,
*:before,
*:after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Georgia', serif;
    font-size: 16px;
    line-height: 1.5;
    color: #4D4D4D;
    background-color: #f9f9f9;
}

body {
    min-height: 100vh;
    min-width: 320px;
    overflow-x: hidden;
    padding: 1em;
}

a {
    color: #1B405B;
    text-decoration: underline;
    transition: color 0.25s ease;
}

a:hover {
    text-decoration: none;
}

a.subtle-link {
    color: #1B405B;
    text-decoration: none;
    border-bottom: 1px dotted #1B405B;
    transition: border-bottom 0.25s ease, color 0.25s ease;
}

a.subtle-link:hover {
    border-bottom: 1px solid #1B405B;
}

h1, h2, h3, h4, h5, h6 {
    color: #1B405B;
    font-family: 'Georgia', serif;
    letter-spacing: -0.05rem;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.875em;
    font-weight: 400;
}

h2 {
    font-size: 2.125em;
    font-weight: 400;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.25em;
    font-weight: 400;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

h4 {
    font-size: 1em;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
}

strong {
    font-weight: bold;
}

hr.divider {
    border: 0;
    height: 1px;
    background-color: rgba(219, 211, 213, 0.529);
    margin: 2rem 0;
    width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

/* Layout */
#wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.inner {
    width: 70rem;
    max-width: 100%;
    padding: 0 4rem;
    margin: 0 auto;
}

/* Container and Card Styling */
.container {
    max-width: 70rem;
    padding: 2em 3em;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 4.2px;
}

.card {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
    border: none;
    background-color: #fff;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(219, 211, 213, 0.529);
}

.card-header.bg-primary {
    background-color: #1B405B !important;
}

.card-header.bg-success {
    background-color: #1B405B !important;
}

.card-body {
    padding: 2rem;
}

/* Button Styling */
.btn {
    display: inline-block;
    padding: 0.9rem 2rem;
    font-family: 'Georgia', serif;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.35s ease-in-out;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: #1B405B;
    border-color: #1B405B;
    color: white;
}

.btn-primary:hover {
    background-color: #2c5a7c;
    border-color: #2c5a7c;
}

.btn-outline-danger, 
.btn-outline-secondary, 
.btn-outline-primary, 
.btn-outline-warning, 
.btn-outline-dark, 
.btn-outline-success, 
.btn-outline-info {
    border-width: 1px;
    background-color: transparent;
}

.btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

.btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-primary {
    color: #1B405B;
    border-color: #1B405B;
}

.btn-outline-warning {
    color: #ffc107;
    border-color: #ffc107;
}

.btn-outline-dark {
    color: #212529;
    border-color: #212529;
}

.btn-outline-success {
    color: #198754;
    border-color: #198754;
}

.btn-outline-info {
    color: #0dcaf0;
    border-color: #0dcaf0;
}

.btn-check:checked + .btn-outline-danger,
.btn-check:checked + .btn-outline-secondary,
.btn-check:checked + .btn-outline-primary,
.btn-check:checked + .btn-outline-warning,
.btn-check:checked + .btn-outline-dark,
.btn-check:checked + .btn-outline-success,
.btn-check:checked + .btn-outline-info {
    background-color: #1B405B;
    border-color: #1B405B;
    color: white;
}

.btn-check:focus + .btn-outline-danger,
.btn-check:focus + .btn-outline-secondary,
.btn-check:focus + .btn-outline-primary,
.btn-check:focus + .btn-outline-warning,
.btn-check:focus + .btn-outline-dark,
.btn-check:focus + .btn-outline-success,
.btn-check:focus + .btn-outline-info {
    box-shadow: 0 0 0 0.25rem rgba(27, 64, 91, 0.25);
}

/* Form Elements */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 1em;
    line-height: 1.4;
    background-color: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    transition: 0.35s ease-in-out;
    transition: all 0.35s ease-in-out;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 0;
    border-color: #1B405B;
    box-shadow: 0 0 0 0.25rem rgba(27, 64, 91, 0.25);
}

.form-label {
    color: #1B405B;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

/* Input Group with Icons */
.input-group {
    margin-bottom: 1em;
    position: relative;
}

.input-group:before,
.input-group:after {
    content: "";
    display: table;
}

.input-group:after {
    clear: both;
}

/* Occasion buttons - full width layout */
.occasion-row {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.occasion-group {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
}

.occasion-group .btn {
    flex: 0 0 auto;
    text-align: center;
    white-space: nowrap;
    margin: 0 0.25em 0.5em 0.25em;
}

.input-group-icon {
    position: relative;
}

.input-group-icon input {
    padding-left: 3em;
}

.input-group-icon .input-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 3em;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.input-group-icon .input-icon i {
    color: #999;
    transition: 0.35s ease-in-out;
}

.input-group-icon input:focus + .input-icon i {
    color: #1B405B;
}

/* Custom Radio Buttons and Checkboxes */
.btn-check {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.btn-check + label {
    display: inline-block;
    padding: 0.75em 1.25em;
    font-size: 1em;
    line-height: 1.5;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    transition: all 0.35s ease-in-out;
    cursor: pointer;
    text-align: center;
    margin-right: 0.5em;
    margin-bottom: 0.5em;
}

.btn-check:checked + label {
    background-color: #1B405B;
    color: white;
    border-color: #1B405B;
}

.btn-check:focus + label {
    box-shadow: 0 0 0 0.25rem rgba(27, 64, 91, 0.25);
}

/* Row and Column Layout */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
    margin-bottom: 1.5em;
}

.col-half {
    flex: 0 0 50%;
    max-width: 50%;
    padding-right: 10px;
    padding-left: 10px;
}

.col-third {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    padding-right: 10px;
    padding-left: 10px;
}

@media only screen and (max-width: 540px) {
    .col-half {
        flex: 0 0 100%;
        max-width: 100%;
        padding-right: 0;
        padding-left: 0;
    }
    
    .col-third {
        flex: 0 0 100%;
        max-width: 100%;
        padding-right: 0;
        padding-left: 0;
    }
}

/* Greeting Container */
.greeting-container {
    background-color: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 2rem;
    position: relative;
    min-height: 150px;
    margin-bottom: 1.5rem;
}

.greeting-text {
    white-space: pre-line;
    line-height: 1.8;
    color: #4D4D4D;
    font-size: 1.05em;
}

/* Additional Questions Container - Mobile Optimized */
#additional-questions-container {
    border-radius: 8px;
}

@media (max-width: 768px) {
    #additional-questions-container {
        padding: 1.5rem !important;
    }
    
    #additional-questions-container h3 {
        font-size: 1.3rem;
    }
    
    #additional-questions-container .form-label {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
        line-height: 1.4;
    }
    
    #additional-questions-container .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
        height: 44px;
        margin-bottom: 1.5rem;
    }
    
    #additional-questions-container .btn {
        width: 100%;
        padding: 0.75rem;
        min-height: 44px;
        font-size: 1.1rem;
    }
}

/* Copy Button */
#copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 3px;
    transition: all 0.35s ease-in-out;
}

#copy-btn:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

#copy-btn.btn-success {
    background-color: #1B405B;
    border-color: #1B405B;
    color: white;
}

/* Animation for copy button */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.btn-success {
    animation: pulse 0.5s;
    background-color: #1B405B;
    border-color: #1B405B;
}

/* Social Icons */
.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3em;
    height: 3em;
    border-radius: 100%;
    border: solid 1px #1B405B;
    transition: transform 0.375s ease, color 0.375s ease, background-color 0.375s ease, border-color 0.375s ease;
    text-decoration: none;
}

.social-icon i {
    font-size: 1.8em;
    color: #1B405B;
}

.social-icon:hover {
    transform: scale(1.1125);
    border-color: #1B405B;
}

/* Header and Footer */
header.text-center {
    margin: 0.0rem 0;
}

.header-logo {
    max-width: 768px;
    height: auto;
    margin-bottom: 0.5rem;
}

header p.lead {
    color: #4D4D4D;
    font-size: 1.25em;
}

footer {
    color: #4D4D4D;
    padding: 2rem 0;
    border-top: 1px solid rgba(219, 211, 213, 0.529);
    margin-top: 3rem;
}

/* Touch Feedback Styling */
.touch-active {
    transform: scale(0.97);
    opacity: 0.9;
    transition: transform 0.1s, opacity 0.1s;
}

/* Active state for touch devices */
@media (hover: none) {
    .btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
}

/* Responsive Design */
@media (max-width: 1680px) {
    html {
        font-size: 12pt;
    }
}

@media (max-width: 1280px) {
    html {
        font-size: 12pt;
    }
}

@media (max-width: 980px) {
    html {
        font-size: 10pt;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 12pt;
    }

    .container, .inner {
        padding: 0 2rem;
    }

    h1 {
        font-size: 3em;
    }

    h2 {
        font-size: 2.125em;
    }

    h3 {
        font-size: 1.25em;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .d-flex.flex-wrap.gap-2 {
        justify-content: center;
    }
    
    /* Improved touch targets */
    .btn {
        padding: 0.75rem 1.5rem; /* Larger padding for mobile devices */
        min-height: 44px; /* Minimum height according to Apple's Human Interface Guidelines */
        min-width: 44px; /* Minimum width for touch targets */
        margin-bottom: 0.75rem; /* More vertical space between buttons */
    }
    
    .btn-check + label {
        padding: 0.75rem 1rem;
        min-height: 44px;
        min-width: 44px;
        margin-right: 0.75rem; /* More horizontal space between options */
        margin-bottom: 0.75rem;
    }
    
    /* More space between radio button groups */
    .input-group {
        margin-bottom: 1.5rem;
    }
    
    /* Better arrangement of options on mobile devices */
    .occasion-group, 
    .input-group {
        justify-content: space-between; /* Even distribution */
    }
    
    .occasion-group .btn,
    .input-group .btn-check + label {
        flex: 0 0 calc(50% - 0.75rem); /* 2 buttons per row with spacing */
        max-width: calc(50% - 0.75rem);
    }
    
    /* Optimized form elements for touch */
    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        padding: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
        height: 44px; /* Consistent height for touch */
    }
    
    /* Larger spacing between form rows */
    .row {
        margin-bottom: 2rem;
    }
    
    /* Larger labels for easier selection */
    .form-label {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    .header-logo {
        max-width: 550px;
    }
}

@media (max-width: 480px) {
    .container, .inner {
        padding: 0 1.5rem;
    }
    
    .header-logo {
        max-width: 380px;
    }
    
    /* For very small screens: 1 button per row */
    .occasion-group .btn,
    .input-group .btn-check + label {
        flex: 0 0 100%;
        max-width: 100%;
        margin-right: 0;
    }
}

@media (max-width: 360px) {
    .container, .inner {
        padding: 0 1.5rem;
    }

    h1 {
        font-size: 2.5em;
    }

    h2 {
        font-size: 1.875em;
    }

    h3 {
        font-size: 1.125em;
    }
    
    .header-logo {
        max-width: 240px;
    }
}
