/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --secondary-color: #60a5fa;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-bg: #0f172a;
    --card-bg: #1e293b;
    --text-color: #e2e8f0;
    --text-light: #94a3b8;
    --border-color: #334155;
    --hover-color: #334155;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    min-height: 100vh;
    animation: gradientShift 15s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

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

/* Navigation */
.navbar {
    background: var(--dark-bg);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.logo:hover {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    padding: 2rem 20px;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.page-header h1 i {
    color: var(--primary-color);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: white;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Card Styles */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-card h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-card h2 i {
    color: var(--primary-color);
}

.tool-card p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

.upload-area i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.upload-area p {
    color: var(--text-light);
    margin: 0;
}

/* Input Groups */
.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

.input-group input[type="text"],
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--dark-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input[type="text"]:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-group textarea {
    resize: vertical;
    font-family: inherit;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

/* Result Area */
.result-area {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 6px;
    display: none;
}

.result-area.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
    display: block;
}

.result-area.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    display: block;
}

.result-area h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.result-area h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.result-area ul {
    list-style-position: inside;
    margin-left: 1rem;
}

.result-area li {
    margin-bottom: 0.25rem;
}

.text-preview {
    background: var(--dark-bg);
    padding: 1rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* File List */
.file-list {
    margin: 1rem 0;
    max-height: 200px;
    overflow-y: auto;
}

.file-list h4 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.file-item {
    background: var(--dark-bg);
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    margin-top: 1rem;
    color: white;
    font-size: 1.1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2rem;
    }

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

    .stats-section {
        grid-template-columns: 1fr;
    }

    .nav-links {
        gap: 1rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* PDF Modal Styles */
.pdf-modal {
    display: none !important;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.pdf-modal.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.pdf-modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pdf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.pdf-modal-header h2 {
    color: var(--text-color);
    font-size: 1.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdf-modal-header h2 i {
    color: var(--danger-color);
}

.pdf-modal-close {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-modal-close:hover {
    background: var(--hover-color);
    color: white;
}

.pdf-modal-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 100px);
}

.pdf-info-section {
    margin-bottom: 2rem;
}

.pdf-info-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.pdf-metadata {
    background: var(--dark-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.pdf-metadata-item {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.pdf-metadata-item:last-child {
    border-bottom: none;
}

.pdf-metadata-label {
    font-weight: 600;
    color: var(--text-color);
    min-width: 120px;
}

.pdf-metadata-value {
    color: var(--text-light);
    flex: 1;
}

.pdf-page-content {
    background: var(--dark-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
}

.pdf-page-header {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.pdf-page-text {
    color: var(--text-color);
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.pdf-page-image-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.pdf-page-image {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments for modal */
@media (max-width: 768px) {
    .pdf-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .pdf-modal-header {
        padding: 1rem;
    }

    .pdf-modal-body {
        padding: 1rem;
    }

    .pdf-modal-header h2 {
        font-size: 1.2rem;
    }
}

/* PDF Creator Styles */
.pdf-creator-content {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
}

.pdf-creator-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: calc(90vh - 80px);
}

.pdf-creator-toolbar {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--dark-bg);
    border-radius: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-section {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0 1rem;
    border-right: 1px solid var(--border-color);
}

.toolbar-section:last-child {
    border-right: none;
}

.toolbar-section label {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.tool-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.tool-btn:hover {
    background: var(--hover-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.tool-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

#colorPicker {
    width: 50px;
    height: 35px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

#fontPicker {
    padding: 0.5rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

#fontPicker:hover {
    border-color: var(--primary-color);
}

#fontPicker:focus {
    outline: none;
    border-color: var(--primary-color);
}

#sizePicker {
    width: 100px;
}

#sizeValue {
    color: var(--primary-color);
    font-weight: 600;
    min-width: 25px;
}

.pdf-creator-canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
    background: var(--dark-bg);
    border-radius: 8px;
    padding: 2rem;
}

#pdfCreatorCanvas {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    cursor: crosshair;
}

/* Responsive PDF Creator */
@media (max-width: 768px) {
    .pdf-creator-toolbar {
        padding: 0.5rem;
    }

    .toolbar-section {
        padding: 0 0.5rem;
    }

    .tool-btn {
        width: 35px;
        height: 35px;
    }

    #pdfCreatorCanvas {
        width: 100%;
        height: auto;
    }
}