/* Mobile-First Light Theme */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #fff;
    color: #000;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 16px;
}

/* Header - Mobile First */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid #ddd;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    line-height: 1.3;
}

.header p {
    color: #666;
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.4;
    padding: 0 8px;
}

/* Form Container */
.form-container {
    max-width: 100%;
}

/* Upload Sections - Mobile Optimized */
.upload-section {
    margin-bottom: 32px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 16px;
    background: #f8f9fa;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.upload-section:nth-child(1) { animation-delay: 0.1s; }
.upload-section:nth-child(2) { animation-delay: 0.2s; }
.upload-section:nth-child(3) { animation-delay: 0.3s; }

.section-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.01em;
    color: #000;
}

.section-icon {
    font-size: 1.3rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* Drop Zone - Mobile Touch Friendly */
.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    position: relative;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover,
.drop-zone:active {
    border-color: #999;
    background: #f5f5f5;
}

.drop-zone.dragover {
    border-color: #000;
    background: #f0f0f0;
    transform: scale(1.02);
}

.drop-zone input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    top: 0;
    left: 0;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    color: #999;
    display: block;
}

.upload-icon img.profile-image {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
    display: inline-block;
    filter: brightness(0.7);
}

.upload-text {
    font-size: 1rem;
    color: #000;
    margin-bottom: 8px;
    font-weight: 400;
    text-align: center;
}

.upload-hint {
    font-size: 0.85rem;
    color: #666;
    font-weight: 300;
    text-align: center;
    line-height: 1.4;
}

/* File List - Mobile Optimized */
.file-list {
    margin-top: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: #f8f9fa;
    border-color: #ccc;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.file-icon {
    width: 36px;
    height: 36px;
    background: #000;
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 400;
    color: #000;
    margin-bottom: 2px;
    font-size: 0.9rem;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.file-size {
    color: #666;
    font-size: 0.8rem;
}

.remove-btn {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
    min-height: 36px;
    touch-action: manipulation;
}

.remove-btn:hover,
.remove-btn:active {
    color: #000;
    border-color: #999;
    background: #f0f0f0;
}

/* Instagram Input Section */
.input-section {
    margin-bottom: 32px;
    padding: 20px 0; /* No extra background, direct placement */
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.4s; /* Adjust delay if needed */
}

.input-label {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: #000;
}

.text-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    color: #000;
    transition: border-color 0.3s ease;
    min-height: 48px; /* For touch targets */
}

.text-input:focus {
    border-color: #000;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.text-input::placeholder {
    color: #999;
}

.input-hint {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-top: 8px;
    font-weight: 300;
}

/* Process Button - Mobile Touch Friendly */
.process-btn {
    background: #000;
    color: #fff;
    border: none;
    padding: 18px 24px;
    font-size: 1.05rem;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    margin-top: 32px;
    transition: all 0.3s ease;
    font-weight: 500;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
    min-height: 56px;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

.process-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #fff;
    transition: left 0.3s ease;
    z-index: -1;
}

.process-btn:hover:not(:disabled)::before,
.process-btn:active:not(:disabled)::before {
    left: 0;
}

.process-btn:hover:not(:disabled),
.process-btn:active:not(:disabled) {
    color: #000;
    transform: translateY(-1px);
}

.process-btn:disabled {
    background: #ddd;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.process-btn:disabled::before {
    display: none;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 3px;
    background: #e0e0e0;
    border-radius: 2px;
    margin-top: 24px;
    overflow: hidden;
    display: none;
}

.progress-fill {
    height: 100%;
    background: #000;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Status Message */
.status-message {
    margin-top: 24px;
    padding: 16px;
    border-radius: 8px;
    display: none;
    font-weight: 300;
    line-height: 1.4;
}

.status-success {
    background: #e6f4ea;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}


/* --- MODAL STYLES (UPDATED TO MATCH DESIGN) --- */
.modal {
    display: none; /* Hidden by default, JS changes to flex */
    position: fixed;
    z-index: 2000; /* Ensure it's on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent scrolling on the overlay itself */
    background-color: rgba(0, 0, 0, 0.6); /* Light theme overlay */
    
    /* Flexbox for centering the modal-content */
    align-items: center;
    justify-content: center;
    padding: 20px 16px; /* Match container padding */
    box-sizing: border-box;
}

.modal-content {
    background: #f8f9fa; /* Match upload-section background */
    color: #000;
    padding: 24px 20px; /* Consistent with upload sections */
    border: 1px solid #e0e0e0; /* Match upload-section border */
    border-radius: 12px; /* Match upload-section border-radius */
    width: 100%;
    max-width: 600px; /* Slightly larger for desktop */
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2); /* Enhanced shadow for depth */
    
    /* Key for mobile: */
    max-height: 85vh; /* Max 85% of viewport height */
    overflow-y: auto; /* Enable vertical scrolling WITHIN the modal content if it's too tall */
    
    /* Flexbox for internal layout */
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content like message, video, button */
    gap: 24px; /* Space between elements inside modal-content */
    
    /* Add subtle animation */
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
    animation: modalFadeIn 0.3s ease-out forwards;
}

/* Close button styling - redesigned to match theme */
.close-button {
    color: #666;
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    z-index: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: #000;
    background: #fff;
    border-color: #ddd;
    transform: scale(1.05);
}

#previewModalMessage {
    font-size: 1.1rem;
    font-weight: 400;
    line-height: 1.5;
    width: 100%;
    text-align: center;
    color: #000;
    letter-spacing: -0.01em;
}

#previewModalTimer {
    font-size: 0.9rem;
    color: #666;
    font-weight: 300;
    padding: 8px 16px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

#previewModalVideo {
    display: block;
    width: 100%;
    height: auto;
    max-height: 50vh; /* Limit video height */
    background-color: #f0f0f0;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
}

/* Modal buttons - styled like process-btn */
.modal-button {
    background: #000;
    color: #fff;
    border: none;
    padding: 18px 24px; /* Match process-btn mobile */
    font-size: 1.05rem;  /* Match process-btn mobile */
    border-radius: 12px; /* Match process-btn */
    cursor: pointer;
    font-weight: 500;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
    min-height: 56px; /* Match process-btn mobile */
    min-width: 200px; /* Retain min-width for modal context */
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-family: inherit;
}

.modal-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #fff; /* Match process-btn hover fill */
    transition: left 0.3s ease;
    z-index: -1;
}

.modal-button:hover:not(:disabled)::before,
.modal-button:active:not(:disabled)::before {
    left: 0;
}

.modal-button:hover:not(:disabled),
.modal-button:active:not(:disabled) {
    color: #000; /* Match process-btn hover text */
    transform: translateY(-1px);
}

.modal-button:disabled { /* Style for disabled modal button if needed */
    background: #ddd;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.modal-button:disabled::before {
    display: none;
}
/* --- END MODAL STYLES --- */


/* Tablet Responsive */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
        padding: 32px 24px;
    }

    .header {
        margin-bottom: 60px;
        padding-bottom: 32px;
    }

    .header h1 {
        font-size: 2.2rem;
    }

    .header p {
        font-size: 1.05rem;
    }

    .upload-section {
        padding: 32px 24px;
        margin-bottom: 48px;
    }

    .input-section {
        margin-bottom: 48px; /* Match upload-section */
    }

    .drop-zone {
        padding: 48px 24px;
        min-height: 180px;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .upload-text {
        font-size: 1.05rem;
    }

    .file-item {
        padding: 20px 16px;
    }

    .file-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .file-name {
        font-size: 0.95rem;
    }

    .process-btn {
        padding: 20px 32px;
        font-size: 1.1rem;
        min-height: 60px;
    }

    .modal {
        padding: 32px 24px;
    }

    .modal-content {
        padding: 32px 28px;
        gap: 28px;
    }

    #previewModalMessage {
        font-size: 1.2rem;
    }

    .modal-button {
        padding: 20px 32px; /* Match process-btn tablet */
        font-size: 1.1rem;   /* Match process-btn tablet */
        min-height: 60px;  /* Match process-btn tablet */
        min-width: 220px;
    }

    .modal-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .container {
        max-width: 1000px; /* Or adjust to match your desired desktop layout width */
        padding: 40px 20px;
    }

    .header {
        margin-bottom: 80px;
        padding-bottom: 40px;
    }

    .header h1 {
        font-size: 2.5rem;
    }

    .header p {
        font-size: 1.1rem;
    }

    .upload-section {
        padding: 40px;
        margin-bottom: 60px;
    }

    .input-section {
        padding: 0 40px; /* Match horizontal padding of upload-section if desired */
        margin-bottom: 60px; /* Match upload-section */
    }

    .drop-zone {
        padding: 60px 40px;
        min-height: 200px;
    }

    .section-title {
        font-size: 1.3rem;
        margin-bottom: 30px;
    }

    .file-item {
        padding: 20px;
    }

    .file-info {
        gap: 15px;
    }

    .file-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .process-btn {
        padding: 20px 40px; /* Font-size and min-height same as tablet */
        margin-top: 40px;
    }

    .modal {
        padding: 40px;
    }

    .modal-content {
        padding: 40px;
        gap: 32px;
        max-width: 700px;
    }

    #previewModalMessage {
        font-size: 1.3rem;
    }

    .modal-button {
        padding: 20px 40px; /* Match process-btn desktop */
        font-size: 1.1rem;   /* Match process-btn desktop (already 1.1rem from tablet) */
        min-height: 60px;  /* Match process-btn desktop (already 60px from tablet) */
        min-width: 240px;
    }
}

/* Animations */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalFadeIn {
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    .drop-zone,
    .process-btn,
    .remove-btn,
    .text-input { /* Added text-input for min height consistency */
        min-height: 44px;
    }
    
    .file-item {
        min-height: 60px;
    }
    /* .modal-button min-height already set by base styles (56px) and responsive (60px) */
}