/* ============================================
   Image to PDF Converter - Red Theme
   Fully Responsive & Accessible
   ============================================ */

/* Reset & Base Styles */
.itpc-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

.itpc-container {
    background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);
    min-height: 100vh;
    padding: 30px 20px;
    color: #000000;
}

.itpc-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.itpc-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 0 15px;
}

.itpc-title {
    color: #000000;
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.itpc-subtitle {
    color: #333333;
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
    opacity: 0.9;
}

/* Converter Layout */
.itpc-converter-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* Upload Section */
.itpc-upload-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #eaeaea;
}

.itpc-section-title {
    color: #000000;
    font-size: 1.6rem;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    font-weight: 700;
}

.itpc-upload-area {
    border: 3px dashed #D00B2B;
    border-radius: 14px;
    padding: 50px 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 25px;
    background: #fff5f5;
    position: relative;
    overflow: hidden;
}

.itpc-upload-area:hover,
.itpc-upload-area:focus {
    background: #ffeaea;
    border-color: #b00824;
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(208, 11, 43, 0.1);
}

.itpc-upload-area:focus {
    outline: 2px solid #D00B2B;
    outline-offset: 2px;
}

.itpc-upload-area i {
    font-size: 64px;
    color: #D00B2B;
    margin-bottom: 20px;
    display: block;
    transition: transform 0.3s ease;
}

.itpc-upload-area:hover i {
    transform: scale(1.1);
}

.itpc-upload-area h3 {
    color: #000000;
    margin-bottom: 12px;
    font-size: 1.6rem;
    font-weight: 700;
}

.itpc-upload-area p {
    color: #555555;
    margin-bottom: 25px;
    font-size: 1.05rem;
    line-height: 1.5;
}

/* Buttons - Red Theme */
.itpc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #D00B2B;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    line-height: 1.5;
    min-height: 48px;
    border: 2px solid transparent;
}

.itpc-btn:hover,
.itpc-btn:focus {
    background: #b00824;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(208, 11, 43, 0.25);
}

.itpc-btn:active {
    transform: translateY(-1px);
}

.itpc-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.itpc-btn i {
    margin-right: 10px;
    color: white;
    font-size: 1.1rem;
}

.itpc-primary-btn {
    background: #D00B2B;
}

.itpc-secondary-btn {
    background: #444444;
}

.itpc-secondary-btn:hover {
    background: #333333;
}

/* Options Section */
.itpc-options-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #eaeaea;
}

.itpc-option-group {
    margin-bottom: 30px;
}

.itpc-option-label {
    display: block;
    font-weight: 700;
    margin-bottom: 15px;
    color: #000000;
    font-size: 1.15rem;
}

/* Radio Buttons */
.itpc-radio-group {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.itpc-radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1.05rem;
    color: #333333;
    position: relative;
}

.itpc-radio-option input {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #D00B2B;
}

.radio-label {
    color: #333333;
    font-weight: 500;
}

/* Page Size Dropdown - FIXED */
.itpc-select-wrapper {
    position: relative;
    width: 100%;
    height: 56px;
}

.itpc-page-size-select {
    width: 100%;
    height: 56px;
    padding: 16px 50px 16px 20px;
    border: 2px solid #D00B2B;
    border-radius: 10px;
    background: white;
    font-size: 1.05rem;
    color: #000000;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-weight: 500;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.itpc-page-size-select:hover {
    border-color: #b00824;
    box-shadow: 0 0 0 4px rgba(208, 11, 43, 0.1);
}

.itpc-page-size-select:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 4px rgba(208, 11, 43, 0.2);
}

.itpc-page-size-select option {
    color: #000000;
    background: white;
    padding: 12px;
    font-size: 1rem;
}

.itpc-select-wrapper::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #D00B2B;
    pointer-events: none;
    font-size: 16px;
    z-index: 1;
}

/* Margin Buttons */
.itpc-margin-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.itpc-margin-btn {
    padding: 16px 12px;
    text-align: center;
    border: 2px solid #dddddd;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1rem;
    color: #333333;
    height: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.itpc-margin-btn:hover {
    border-color: #D00B2B;
    color: #D00B2B;
    transform: translateY(-2px);
}

.itpc-margin-btn.active {
    background: #D00B2B;
    color: white;
    border-color: #D00B2B;
    box-shadow: 0 5px 15px rgba(208, 11, 43, 0.2);
}

/* Checkbox */
.itpc-checkbox-option {
    display: flex;
    align-items: center;
    margin-top: 25px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    border: 1px solid #eaeaea;
}

.itpc-checkbox-option input {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #D00B2B;
}

.itpc-checkbox-option label {
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    color: #000000;
    flex: 1;
}

/* Preview Section */
.itpc-preview-section {
    grid-column: 1 / -1;
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #eaeaea;
    margin-top: 20px;
}

.itpc-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 20px;
}

.itpc-image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
    max-height: 320px;
    overflow-y: auto;
    padding: 20px;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    min-height: 160px;
    background: #fafafa;
    scrollbar-width: thin;
    scrollbar-color: #D00B2B #f0f0f0;
}

.itpc-image-preview::-webkit-scrollbar {
    width: 8px;
}

.itpc-image-preview::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.itpc-image-preview::-webkit-scrollbar-thumb {
    background: #D00B2B;
    border-radius: 4px;
}

.itpc-image-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: white;
}

.itpc-image-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.itpc-image-item img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
    background: #f0f0f0;
}

.itpc-image-name {
    padding: 12px 10px;
    font-size: 0.9rem;
    text-align: center;
    background: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333333;
    border-top: 1px solid #eee;
    font-weight: 500;
}

.itpc-remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(208, 11, 43, 0.95);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.itpc-remove-image:hover {
    background: rgba(208, 11, 43, 1);
    transform: scale(1.1);
}

.itpc-empty-state {
    text-align: center;
    grid-column: 1/-1;
    padding: 50px 30px;
    color: #666666;
}

.itpc-empty-state i {
    font-size: 56px;
    margin-bottom: 20px;
    color: #D00B2B;
    opacity: 0.7;
}

.itpc-empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
    color: #555555;
}

/* Action Buttons */
.itpc-action-buttons {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.itpc-action-btn {
    padding: 18px 40px;
    font-size: 1.15rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    justify-content: center;
}

/* Loading Animation */
.itpc-loading {
    display: none;
    text-align: center;
    margin: 25px 0;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 2px solid #f0f0f0;
}

.itpc-loading.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.itpc-spinner {
    border: 4px solid rgba(208, 11, 43, 0.1);
    border-radius: 50%;
    border-top: 4px solid #D00B2B;
    width: 50px;
    height: 50px;
    animation: spin 1.2s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.itpc-loading p {
    color: #000000;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Success Message */
.itpc-success-message {
    background: #d4edda;
    color: #155724;
    padding: 20px;
    border-radius: 10px;
    margin-top: 25px;
    text-align: center;
    display: none;
    border-left: 5px solid #28a745;
    animation: fadeIn 0.5s ease;
}

.itpc-success-message.active {
    display: block;
}

.itpc-success-message i {
    margin-right: 12px;
    color: #28a745;
    font-size: 1.3rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.itpc-footer {
    text-align: center;
    margin-top: 60px;
    color: #666666;
    font-size: 0.95rem;
    padding-top: 25px;
    border-top: 1px solid #eaeaea;
}

.itpc-footer-note {
    margin-top: 8px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.itpc-footer .fa-heart {
    color: #D00B2B;
    animation: heartbeat 1.5s ease-in-out infinite;
    display: inline-block;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    5% { transform: scale(1.1); }
    10% { transform: scale(1); }
    15% { transform: scale(1.2); }
    20%, 50% { transform: scale(1); }
}

.itpc-note {
    color: #666666;
    font-size: 0.95rem;
    margin-top: 15px;
    padding: 12px 16px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #D00B2B;
}

.itpc-note i {
    margin-right: 8px;
    color: #D00B2B;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .itpc-title {
        font-size: 2.2rem;
    }
    
    .itpc-subtitle {
        font-size: 1.1rem;
    }
    
    .itpc-converter-wrapper {
        gap: 25px;
    }
}

/* Mobile Landscape (576px - 768px) */
@media (max-width: 768px) {
    .itpc-container {
        padding: 20px 15px;
    }
    
    .itpc-wrapper {
        padding: 15px;
    }
    
    .itpc-title {
        font-size: 2rem;
        margin-bottom: 12px;
    }
    
    .itpc-subtitle {
        font-size: 1.05rem;
    }
    
    .itpc-converter-wrapper {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .itpc-upload-section,
    .itpc-options-section,
    .itpc-preview-section {
        padding: 25px;
    }
    
    .itpc-section-title {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }
    
    .itpc-upload-area {
        padding: 35px 20px;
    }
    
    .itpc-upload-area i {
        font-size: 56px;
    }
    
    .itpc-upload-area h3 {
        font-size: 1.4rem;
    }
    
    .itpc-option-label {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .itpc-radio-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .itpc-margin-buttons {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .itpc-page-size-select {
        height: 52px;
        padding: 14px 45px 14px 16px;
    }
    
    .itpc-select-wrapper {
        height: 52px;
    }
    
    .itpc-action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .itpc-action-btn {
        width: 100%;
        max-width: 320px;
        min-width: auto;
        padding: 16px 30px;
    }
    
    .itpc-preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .itpc-image-preview {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
        padding: 15px;
    }
    
    .itpc-image-item img {
        height: 110px;
    }
}

/* Mobile Portrait (up to 576px) */
@media (max-width: 576px) {
    .itpc-container {
        padding: 15px 10px;
    }
    
    .itpc-title {
        font-size: 1.8rem;
    }
    
    .itpc-subtitle {
        font-size: 1rem;
    }
    
    .itpc-upload-section,
    .itpc-options-section,
    .itpc-preview-section {
        padding: 20px;
    }
    
    .itpc-section-title {
        font-size: 1.3rem;
    }
    
    .itpc-upload-area {
        padding: 30px 15px;
    }
    
    .itpc-upload-area i {
        font-size: 48px;
    }
    
    .itpc-upload-area h3 {
        font-size: 1.3rem;
    }
    
    .itpc-btn {
        padding: 12px 20px;
        font-size: 1rem;
        min-height: 44px;
    }
    
    .itpc-action-btn {
        padding: 14px 25px;
        font-size: 1.05rem;
    }
    
    .itpc-image-preview {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .itpc-image-item img {
        height: 100px;
    }
    
    .itpc-footer {
        margin-top: 40px;
        font-size: 0.9rem;
    }
}

/* Small Mobile (up to 400px) */
@media (max-width: 400px) {
    .itpc-title {
        font-size: 1.6rem;
    }
    
    .itpc-upload-area h3 {
        font-size: 1.2rem;
    }
    
    .itpc-upload-area p {
        font-size: 1rem;
    }
    
    .itpc-image-preview {
        grid-template-columns: 1fr 1fr;
    }
    
    .itpc-action-btn {
        min-width: 100%;
    }
}

/* Print Styles */
@media print {
    .itpc-container {
        background: white !important;
        padding: 0 !important;
    }
    
    .itpc-converter-wrapper,
    .itpc-action-buttons,
    .itpc-footer {
        display: none !important;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .itpc-upload-area,
    .itpc-btn,
    .itpc-margin-btn,
    .itpc-radio-option,
    .itpc-image-item,
    .itpc-remove-image,
    .itpc-footer .fa-heart {
        transition: none !important;
        animation: none !important;
    }
    
    .itpc-spinner {
        animation-duration: 0s !important;
    }
}

/* Accessibility - High Contrast */
@media (prefers-contrast: high) {
    .itpc-btn {
        border: 2px solid #000000 !important;
    }
    
    .itpc-upload-area {
        border: 3px dashed #000000 !important;
    }
    
    .itpc-page-size-select {
        border: 2px solid #000000 !important;
    }
}