/**
 * WordPDF Studio - Main Stylesheet
 * Mobile-first responsive design with accessibility features
 */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background-color: #ffffff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Screen Reader Only Content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Management */
*:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #2563eb;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* App Navigation */
.app-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
    text-decoration: none;
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Upload Section */
.upload-section {
    margin-bottom: 3rem;
}

.upload-container {
    max-width: 800px;
    margin: 0 auto;
}

.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background-color: #f9fafb;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: #2563eb;
    background-color: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

.upload-zone.drag-over::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    pointer-events: none;
}

.upload-icon img {
    transition: transform 0.3s ease;
}

.upload-zone:hover .upload-icon img,
.upload-zone.drag-over .upload-icon img {
    transform: scale(1.1);
}

.upload-content {
    margin-bottom: 2rem;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-zone h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.upload-zone p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.upload-info {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

.upload-info p {
    margin: 0.25rem 0;
}

.privacy-note {
    color: #059669 !important;
    font-weight: 500;
    margin-top: 1rem !important;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 0.5rem;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: #6b7280;
    border: 1px solid transparent;
}

.btn-icon:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.btn-download {
    background-color: #059669;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-download:hover {
    background-color: #047857;
}

/* File Queue */
.file-queue {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.file-queue h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.file-icon {
    font-size: 2rem;
}

.file-details h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.file-meta {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.file-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-uploaded {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-processing {
    background-color: #fef3c7;
    color: #92400e;
}

.status-completed {
    background-color: #d1fae5;
    color: #065f46;
}

.status-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.file-progress {
    width: 100%;
    margin-top: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #2563eb;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: #6b7280;
    margin-left: 0.5rem;
}

.file-error {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.queue-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.empty-queue {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 2rem;
}

/* Conversion Options */
.conversion-options {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.conversion-options h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2rem;
    text-align: center;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem;
    background: #f9fafb;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.option-card:hover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

.option-card:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.option-card img {
    transition: transform 0.3s ease;
}

.option-card:hover img {
    transform: scale(1.1);
}

.option-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.option-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
}

.option-card p {
    color: #6b7280;
    text-align: center;
    margin: 0;
}

/* Processing Status */
.processing-status {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.processing-status h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2rem;
    text-align: center;
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Results */
.results {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.results h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2rem;
    text-align: center;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 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;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
}

.close-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Settings */
.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.setting-group input,
.setting-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
}

.setting-group input:focus,
.setting-group select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.setting-group small {
    display: block;
    color: #6b7280;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.setting-group a {
    color: #2563eb;
    text-decoration: none;
}

.setting-group a:hover {
    text-decoration: underline;
}

/* Notifications */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

.notification-info {
    background-color: #3b82f6;
}

.notification-success {
    background-color: #10b981;
}

.notification-warning {
    background-color: #f59e0b;
}

.notification-error {
    background-color: #ef4444;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Error Container */
.error-container {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.error-container h3 {
    color: #dc2626;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.error-container ul {
    margin: 0;
    padding-left: 1.5rem;
}

.error-container li {
    color: #dc2626;
    font-size: 0.875rem;
}

/* PDF Preview Styles */
.pdf-preview-container {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.pdf-viewer {
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
}

.pdf-page-container {
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
}

.pdf-page-container canvas {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-number {
    position: absolute;
    bottom: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.875rem;
    color: #6b7280;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.pdf-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    max-height: 200px;
    overflow-y: auto;
}

.pdf-thumbnail {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.pdf-thumbnail:hover {
    border-color: #2563eb;
}

.pdf-thumbnail canvas {
    border-radius: 2px;
}

/* Fullscreen PDF Viewer */
.pdf-fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.pdf-fullscreen-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    margin: 2rem;
    border-radius: 8px;
    overflow: hidden;
}

.pdf-fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.pdf-fullscreen-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.pdf-fullscreen-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.pdf-fullscreen-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 1rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.pdf-fullscreen-footer button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Task Items */
.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.task-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.task-icon {
    font-size: 2rem;
}

.task-details h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.task-details p {
    font-size: 0.875rem;
    color: #374151;
    margin: 0 0 0.25rem 0;
}

.task-details small {
    font-size: 0.75rem;
    color: #6b7280;
}

.task-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
}

.task-error {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .upload-zone {
        padding: 2rem 1rem;
    }

    .upload-icon {
        font-size: 3rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .file-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .file-status {
        width: 100%;
        justify-content: space-between;
    }

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

    .modal {
        padding: 0.5rem;
    }

    .modal-content {
        max-height: 95vh;
    }

    .pdf-fullscreen-content {
        margin: 1rem;
    }

    .pdf-fullscreen-footer {
        flex-direction: column;
        gap: 1rem;
    }

    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .task-status {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .upload-zone {
        padding: 1.5rem 1rem;
    }

    .upload-zone h2 {
        font-size: 1.25rem;
    }

    .option-card {
        padding: 1.5rem 1rem;
    }

    .option-icon {
        font-size: 2.5rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid currentColor;
    }

    .btn-secondary {
        border: 2px solid currentColor;
    }

    .upload-zone {
        border-width: 3px;
    }

    .file-card,
    .option-card {
        border: 2px solid #374151;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .notification {
        animation: none;
    }
}

/* SVG Icon Styles - Blue Color */
.feature-card img,
.option-card img,
.upload-icon img,
.file-icon img,
.task-icon img {
    filter: invert(27%) sepia(96%) saturate(1234%) hue-rotate(200deg) brightness(98%) contrast(95%);
    transition: all 0.3s ease;
}

.feature-card:hover img,
.option-card:hover img {
    transform: scale(1.05);
    filter: invert(27%) sepia(96%) saturate(1234%) hue-rotate(200deg) brightness(110%) contrast(105%);
}

.upload-icon:hover img {
    transform: scale(1.1);
    filter: invert(27%) sepia(96%) saturate(1234%) hue-rotate(200deg) brightness(110%) contrast(105%);
}

/* Additional blue variants for different contexts */
.privacy-section img {
    filter: invert(27%) sepia(96%) saturate(1234%) hue-rotate(200deg) brightness(98%) contrast(95%);
}

.offline-icon img {
    filter: invert(27%) sepia(96%) saturate(1234%) hue-rotate(200deg) brightness(98%) contrast(95%);
}

/* Enhanced Feature Cards */
.feature-card {
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

/* Print Styles */
@media print {
    .app-nav,
    .queue-actions,
    .modal,
    .notification {
        display: none !important;
    }

    .main-content {
        max-width: none;
        padding: 0;
    }

    .file-card,
    .conversion-options,
    .processing-status,
    .results {
        box-shadow: none;
        border: 1px solid #000;
    }
}
