/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f0e8;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: #333;
}

header h1 {
    font-size: 2.5em;
    font-weight: 600;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.main-content {
    max-width: 800px;
    margin: 0 auto;
}

/* Form section */
.form-section {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.step {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.step:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.step h2 {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2d3748;
}

/* Upload area */
.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #667eea;
    background: #edf2f7;
}

.upload-content svg {
    color: #a0aec0;
    margin-bottom: 16px;
}

.upload-content p {
    font-size: 1em;
    color: #4a5568;
    margin-bottom: 8px;
}

.upload-link {
    color: #667eea;
    font-weight: 500;
}

.upload-hint {
    font-size: 0.9em;
    color: #a0aec0;
}

/* Photo editor */
.photo-editor {
    margin-top: 20px;
}

.editor-controls {
    margin-bottom: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
}

.control-row:last-child {
    margin-bottom: 0;
}

.editor-controls label {
    font-size: 0.9em;
    color: #4a5568;
    font-weight: 500;
    min-width: 50px;
}

.editor-controls input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.rotation-controls {
    display: flex;
    gap: 8px;
}

.rotate-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #4a5568;
}

.rotate-btn:hover {
    border-color: #667eea;
    background: #edf2f7;
    color: #667eea;
}

.rotate-btn:active {
    transform: scale(0.95);
}

.crop-container {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #f7fafc;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    position: relative;
}

#cropCanvas {
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: grab;
    max-width: 100%;
    height: auto;
    display: block;
}

#cropCanvas:active {
    cursor: grabbing;
}

.drag-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    pointer-events: none;
    z-index: 10;
    animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Message input */
.message-container {
    position: relative;
}

#messageText {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
}

#messageText:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.char-counter {
    margin-top: 8px;
    font-size: 0.9em;
    color: #a0aec0;
    text-align: right;
}

/* Address form */
.address-form {
    margin-bottom: 25px;
}

.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    font-size: 14px;
    color: #555;
    margin-bottom: 4px;
}

.form-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-size: 14px;
    color: #555;
    margin-bottom: 4px;
}

.form-row input,
.form-row select,
.form-field input,
.form-field select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-row input:focus,
.form-row select:focus,
.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.sender-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #eee;
}

.sender-section h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 16px;
    color: #4a5568;
}

/* Inline Preview Section (inside form) */
.preview-section-inline {
    margin: 30px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-section-inline h2 {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.preview-section-inline .postcard-preview {
    max-width: 625px;
    width: 100%;
}

/* Submit section */
.submit-section {
    margin-top: 30px;
    text-align: center;
}

.btn-primary {
    background: #8B6F47;
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 111, 71, 0.3);
    background: #A0826B;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* Preview section */
.preview-section {
    position: sticky;
    top: 20px;
}

.preview-section h2 {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.postcard-preview {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.postcard-front,
.postcard-back {
    width: 625px;
    height: 425px;
    position: relative;
}

.postcard-front {
    background: #f7fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.postcard-image {
    width: 100%;
    height: 100%;
    position: relative;
}

.postcard-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    background: #f7fafc;
}

.photo-placeholder svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.photo-placeholder p {
    font-size: 14px;
    color: #718096;
    margin: 0;
}

.postcard-back {
    background: #fff;
    display: flex;
    padding: 30px;
    border-top: 1px solid #e2e8f0;
}

.message-area {
    flex: 1;
    margin-right: 30px;
    padding-right: 30px;
    border-right: 1px solid #e2e8f0;
}

.message-content {
    font-size: 15px;
    line-height: 1.4;
    color: #2d3748;
    word-wrap: break-word;
    white-space: pre-wrap;
    max-height: 365px;
    overflow: hidden;
}

.address-area {
    width: 220px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.stamp-area {
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    border: 2px solid #2d3748;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
    color: #2d3748;
}

.address-content {
    margin-top: 70px;
}

.recipient-address {
    font-size: 13px;
    line-height: 1.4;
    color: #2d3748;
    padding-top: 75px;
}

.recipient-address div {
    margin-bottom: 3px;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal-content h2 {
    font-size: 1.6em;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2d3748;
}

.modal-content.error h2 {
    color: #e53e3e;
}

.success-details,
.error-details {
    margin: 20px 0;
    text-align: left;
}

.success-details p,
.error-details p {
    margin-bottom: 10px;
    color: #4a5568;
}

.success-details strong {
    color: #2d3748;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.payment-details {
    margin: 20px 0;
}

.payment-details p {
    margin-bottom: 20px;
    color: #4a5568;
    font-size: 1.05em;
}

.venmo-section {
    background: #f7fafc;
    padding: 25px;
    border-radius: 12px;
    margin: 25px 0;
}

.venmo-button {
    display: inline-block;
    background: #008CFF;
    color: white;
    padding: 14px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
    transition: all 0.2s ease;
    margin-bottom: 15px;
}

.venmo-button:hover {
    background: #0077D9;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 140, 255, 0.3);
}

.payment-note {
    font-size: 0.9em;
    color: #718096;
    margin-top: 15px;
    font-style: italic;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        max-width: 100%;
    }

    .preview-section {
        position: static;
        order: -1;
    }

    .postcard-preview {
        max-width: 100%;
        overflow: hidden;
    }

    .postcard-front,
    .postcard-back {
        width: 100%;
        height: auto;
        aspect-ratio: 1.47;
    }

    .postcard-back {
        padding: 15px;
    }

    .message-area {
        margin-right: 15px;
        padding-right: 15px;
    }

    .message-content {
        font-size: 12px;
        line-height: 1.4;
        max-height: none;
    }

    .address-area {
        width: 40%;
    }

    .recipient-address {
        font-size: 10px;
        line-height: 1.3;
        padding-top: 50px;
    }

    .stamp-area {
        width: 40px;
        height: 40px;
        font-size: 7px;
    }

    .form-row-split {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2em;
    }

    header p {
        font-size: 1em;
    }

    .container {
        padding: 15px;
    }

    .form-section {
        padding: 20px;
    }

    .modal-content {
        padding: 30px 20px;
        margin: 20px;
    }

    .error-actions {
        flex-direction: column;
    }
}

/* Removed loading states - just keep button disabled without loader */

/* Additional enhancements */
/* Removed decorative dots from step headers */

.upload-area:hover .upload-content svg {
    color: #667eea;
    transform: scale(1.1);
    transition: all 0.3s ease;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: none;
}

/* Mobile Responsive Styles */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .submit-section {
        text-align: center;
        padding: 20px 0;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    header p {
        font-size: 1em;
    }

    .form-section,
    .preview-section {
        padding: 20px;
        border-radius: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .crop-container {
        max-width: 100%;
        overflow: hidden;
    }

    #cropCanvas {
        max-width: 100%;
        height: auto;
    }

    /* Make preview text smaller on mobile */
    .message-content {
        font-size: 11px;
        line-height: 1.4;
    }

    .recipient-address {
        font-size: 9px;
        line-height: 1.2;
        padding-top: 50px;
    }

    .stamp-area {
        width: 40px;
        height: 40px;
        font-size: 6px;
    }

    .preview-section {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .postcard-preview {
        width: 400px;
        max-width: calc(100vw - 60px);
        transform: none;
    }

    .postcard-front,
    .postcard-back {
        width: 100%;
        height: auto;
        aspect-ratio: 5/3;
    }

    .modal-content {
        max-width: 90%;
        padding: 20px;
        margin: 20px;
    }

    .success-details {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }

    .form-section,
    .preview-section {
        padding: 15px;
    }

    .postcard-preview {
        width: 350px;
        max-width: calc(100vw - 40px);
        transform: none;
    }

    .postcard-front,
    .postcard-back {
        width: 100%;
        height: auto;
        aspect-ratio: 5/3;
    }

    .btn-primary,
    .btn-secondary {
        padding: 12px 20px;
        font-size: 0.9em;
    }

    .upload-area {
        padding: 30px 15px;
    }

    textarea {
        min-height: 120px;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    color: #8b7355;
    font-size: 0.9em;
    font-style: italic;
}

footer p {
    margin: 0;
}