/* assets/style.css - Frontend Styles Complete */

.pdf-audio-qr-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: Arial, sans-serif;
}

.pdf-audio-qr-container h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid #007cba;
    padding-bottom: 5px;
}

/* Upload Section */
.upload-section {
    margin-bottom: 30px;
}

.file-input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-input-label {
    display: block;
    padding: 20px;
    background: #f7f7f7;
    border: 2px dashed #007cba;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-input-label:hover,
.file-input-label.dragover {
    background: #e3f2fd;
    border-color: #005a87;
    transform: scale(1.02);
}

.file-input-text {
    color: #666;
    font-size: 16px;
    font-weight: 500;
}

.file-input-text::before {
    content: "📄";
    display: block;
    font-size: 32px;
    margin-bottom: 10px;
}

.file-selected .file-input-label {
    background: #e8f5e8;
    border-color: #28a745;
}

.file-selected .file-input-text {
    color: #155724;
}

.file-selected .file-input-text::before {
    content: "✅";
}

.btn-process {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-process:hover {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.btn-process:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-process:disabled:hover {
    background: #ccc;
    transform: none;
}

/* Processing Status */
.processing-status {
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.progress-bar {
    width: 100%;
    height: 25px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #0099cc, #00bcd4);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 15px;
    position: relative;
    animation: progress-shimmer 2s infinite;
}

@keyframes progress-shimmer {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

.progress-fill::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progress-wave 1.5s infinite;
}

@keyframes progress-wave {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.status-text {
    margin: 0;
    color: #666;
    font-weight: 600;
    font-size: 16px;
}

/* Results Section */
.result-section {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #b3d9ff;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-section h3 {
    color: #0066cc;
    margin-bottom: 20px;
    font-size: 20px;
    text-align: center;
}

.result-item {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    border: 1px solid rgba(0, 124, 186, 0.1);
    transition: transform 0.2s ease;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.1);
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-item label {
    display: block;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-item audio {
    width: 100%;
    margin-top: 8px;
    border-radius: 4px;
}

.result-item img {
    max-width: 150px;
    height: auto;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.result-item img:hover {
    transform: scale(1.05);
}

.btn-download {
    display: inline-block;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-download:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error and Success Messages */
.error-message {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    padding: 15px 20px;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #dc3545;
    animation: slideIn 0.3s ease;
}

.success-message {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    padding: 15px 20px;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #28a745;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Drag and Drop Enhancements */
.file-input-wrapper.drag-active .file-input-label {
    background: #e3f2fd;
    border-color: #1976d2;
    transform: scale(1.02);
}

.file-input-wrapper.drag-active .file-input-text::before {
    content: "⬇️";
    animation: bounce 0.6s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Audio Info Enhancement */
.audio-info {
    font-size: 12px;
    color: #666;
    margin: 5px 0;
    font-style: italic;
    text-align: center;
}

/* QR Modal for enlarged view */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.qr-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}

.qr-modal img:hover {
    transform: scale(1.05);
}

.qr-modal .close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    font-weight: bold;
}

.qr-modal .close-btn:hover {
    color: #ccc;
}

/* Enhanced Button Effects */
.result-item .btn-download {
    position: relative;
    overflow: hidden;
}

.result-item .btn-download::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.result-item .btn-download:hover::after {
    width: 300px;
    height: 300px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pdf-audio-qr-container {
        margin: 10px;
        padding: 15px;
    }
    
    .file-input-label {
        padding: 15px;
        min-height: 80px;
    }
    
    .file-input-text {
        font-size: 14px;
    }
    
    .file-input-text::before {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .result-item img {
        max-width: 120px;
    }
    
    .btn-process,
    .btn-download {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }
    
    .result-item {
        padding: 12px;
    }
    
    .processing-status {
        padding: 20px 15px;
    }
    
    .progress-bar {
        height: 20px;
    }
}

@media (max-width: 480px) {
    .pdf-audio-qr-container h3 {
        font-size: 16px;
    }
    
    .result-section h3 {
        font-size: 18px;
    }
    
    .file-input-text {
        font-size: 13px;
    }
    
    .btn-process {
        font-size: 14px;
        padding: 12px 20px;
    }
    
    .result-item label {
        font-size: 12px;
    }
    
    .qr-modal img {
        max-width: 95%;
        max-height: 80%;
    }
    
    .qr-modal .close-btn {
        top: 10px;
        right: 15px;
        font-size: 24px;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .pdf-audio-qr-container {
        background: #2a2a2a;
        border-color: #555;
        color: #e4e4e4;
    }
    
    .pdf-audio-qr-container h3 {
        color: #e4e4e4;
        border-bottom-color: #007cba;
    }
    
    .file-input-label {
        background: #3a3a3a;
        border-color: #007cba;
    }
    
    .file-input-label:hover {
        background: #4a4a4a;
    }
    
    .file-input-text {
        color: #ccc;
    }
    
    .processing-status {
        background: #333;
        border-color: #555;
    }
    
    .result-section {
        background: #333;
        border-color: #555;
    }
    
    .result-item {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .result-item label {
        color: #e4e4e4;
    }
    
    .status-text,
    .audio-info {
        color: #ccc;
    }
    
    .error-message {
        background: #4a2c2c;
        color: #ff9999;
        border-color: #6b3333;
    }
    
    .success-message {
        background: #2c4a2c;
        color: #99ff99;
        border-color: #336b33;
    }
}

/* Print Styles */
@media print {
    .pdf-audio-qr-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .upload-section,
    .processing-status {
        display: none;
    }
    
    .btn-process,
    .btn-download {
        display: none;
    }
    
    .result-section {
        background: white;
        border: 1px solid #000;
    }
    
    .result-item {
        break-inside: avoid;
    }
    
    .result-item audio {
        display: none;
    }
}

/* Accessibility Improvements */
.btn-process:focus,
.btn-download:focus {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

.file-input-wrapper input[type="file"]:focus + .file-input-label {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .pdf-audio-qr-container {
        border: 2px solid #000;
    }
    
    .file-input-label {
        border: 2px solid #000;
    }
    
    .btn-process {
        background: #000;
        border: 2px solid #000;
    }
    
    .btn-download {
        background: #000;
        border: 2px solid #000;
    }
    
    .result-item img {
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .progress-fill,
    .file-input-label,
    .btn-process,
    .btn-download,
    .result-item,
    .error-message,
    .success-message {
        animation: none;
        transition: none;
    }
    
    .file-input-label:hover,
    .btn-process:hover,
    .btn-download:hover,
    .result-item:hover,
    .result-item img:hover {
        transform: none;
    }
    
    .progress-fill::after {
        animation: none;
    }
    
    .qr-modal img:hover {
        transform: none;
    }
}

/* Loading State Enhancements */
.btn-process.loading {
    position: relative;
    color: transparent !important;
}

.btn-process.loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* File Type Icons */
.file-input-text.pdf-selected::before {
    content: "📄";
    color: #dc3545;
}

.file-input-text.processing::before {
    content: "⚙️";
    animation: spin 2s linear infinite;
}

.file-input-text.completed::before {
    content: "✅";
    color: #28a745;
}

/* Smooth Transitions */
* {
    box-sizing: border-box;
}

.pdf-audio-qr-container,
.pdf-audio-qr-container * {
    transition: all 0.3s ease;
}

/* Custom Scrollbar for Results */
.result-section::-webkit-scrollbar {
    width: 8px;
}

.result-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.result-section::-webkit-scrollbar-thumb {
    background: #007cba;
    border-radius: 4px;
}

.result-section::-webkit-scrollbar-thumb:hover {
    background: #005a87;
}