:root {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent: #bb86fc;
    --accent-hover: #9a67ea;
    --error: #cf6679;
    --success: #4caf50;
    --warning: #ff9800;
    --border-radius: 10px;
    --transition: all 0.3s ease;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    color: var(--text-primary);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    overflow-x: hidden;
}

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

header {
    text-align: center;
    padding: 30px 0;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    background: linear-gradient(90deg, var(--bg-secondary), var(--bg-tertiary));
    box-shadow: var(--box-shadow);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

header h1 {
    color: var(--accent);
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(187, 134, 252, 0.3);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 15px;
}

.feature-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--accent);
    color: #121212;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.8rem;
    animation: pulse 2s infinite;
    box-shadow: 0 0 15px rgba(187, 134, 252, 0.5);
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 10px rgba(187, 134, 252, 0.5); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(187, 134, 252, 0.8); }
    100% { transform: scale(1); box-shadow: 0 0 10px rgba(187, 134, 252, 0.5); }
}

.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (min-width: 992px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
    }
}

.upload-section, .preview-section {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease;
}

.upload-section:hover, .preview-section:hover {
    transform: translateY(-5px);
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
    color: var(--accent);
    display: flex;
    align-items: center;
}

.section-title::before {
    content: "•";
    margin-left: 10px;
    color: var(--accent);
    font-size: 1.8rem;
}

.drop-area {
    border: 2px dashed #555;
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.drop-area:hover, .drop-area.dragover {
    border-color: var(--accent);
    background-color: rgba(187, 134, 252, 0.05);
}

.drop-area::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.drop-area:hover::after, .drop-area.dragover::after {
    opacity: 1;
}

.drop-icon {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 15px;
    display: block;
    transition: transform 0.3s;
}

.drop-area:hover .drop-icon {
    transform: translateY(-5px);
}

.file-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 15px;
}

.btn {
    background-color: var(--accent);
    color: #121212;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    text-align: center;
    margin: 5px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
    z-index: -1;
}

.btn:hover::before {
    transform: translateX(100%);
}

.btn:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 0 15px rgba(187, 134, 252, 0.5);
}

.btn-secondary {
    background-color: #333;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #444;
}

.options {
    margin: 20px 0;
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: var(--border-radius);
}

.option-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.option-group label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
}

.option-group input[type="checkbox"] {
    margin-left: 10px;
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    cursor: pointer;
}

select, input[type="number"] {
    width: 100%;
    padding: 12px;
    background-color: #333;
    color: var(--text-primary);
    border: 1px solid #555;
    border-radius: var(--border-radius);
    transition: all 0.3s;
}

select:focus, input[type="number"]:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 10px rgba(187, 134, 252, 0.3);
}

.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.preview-item {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
}

.preview-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(187, 134, 252, 0.3);
}

.preview-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.preview-item .remove {
    position: absolute;
    top: 5px;
    left: 5px;
    background-color: var(--error);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    z-index: 2;
}

.preview-item .remove:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(207, 102, 121, 0.5);
}

.ocr-processing {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    z-index: 2;
    animation: pulse 1.5s infinite;
}

.actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
    gap: 15px;
}

.ad-container {
    margin: 30px 0;
    padding: 25px;
    background: linear-gradient(90deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: var(--border-radius);
    text-align: center;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--box-shadow);
    border: 1px solid #333;
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 30px 20px;
    border-top: 1px solid #333;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.legal-links {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.legal-links a {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
    padding-bottom: 3px;
}

.legal-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s;
}

.legal-links a:hover::after {
    width: 100%;
}

.progress-container {
    display: none;
    margin: 20px 0;
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: var(--border-radius);
}

.progress-bar {
    height: 12px;
    background-color: #333;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    width: 0%;
    transition: width 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.progress-text {
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 5px rgba(187, 134, 252, 0.5);
}

.error-message {
    color: var(--error);
    text-align: center;
    margin: 15px 0;
    padding: 15px;
    background: rgba(207, 102, 121, 0.1);
    border-radius: var(--border-radius);
    display: none;
}

.text-result {
    background: linear-gradient(90deg, #1a2a3a, #1a1a2e);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-top: 25px;
    display: none;
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(187, 134, 252, 0.2);
}

.text-result h3 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 1.4rem;
    text-align: center;
    text-shadow: 0 2px 5px rgba(187, 134, 252, 0.3);
}

.extracted-text {
    background: rgba(30, 30, 46, 0.7);
    border-radius: var(--border-radius);
    padding: 20px;
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(187, 134, 252, 0.1);
    font-size: 0.95rem;
    line-height: 1.8;
}

.extracted-item {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(187, 134, 252, 0.1);
}

.extracted-item h4 {
    color: var(--accent);
    margin-bottom: 10px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.extracted-item h4::before {
    content: "▹";
    margin-left: 10px;
    color: var(--accent);
}

#output {
    margin-top: 25px;
    padding: 20px;
    background: rgba(30, 30, 46, 0.7);
    border-radius: var(--border-radius);
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(187, 134, 252, 0.1);
    font-size: 0.95rem;
    line-height: 1.8;
}

#output b {
    color: var(--accent);
    display: block;
    margin-bottom: 10px;
}

/* شريط التمرير */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(30, 30, 46, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

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

/* تأثيرات للعناصر عند التحميل */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.upload-section, .preview-section {
    animation: fadeIn 0.6s ease forwards;
}

.upload-section {
    animation-delay: 0.2s;
}

.preview-section {
    animation-delay: 0.4s;
}

/* تأثيرات للزر عند التمرير */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(187, 134, 252, 0.5);
    z-index: 1000;
}

.scroll-top.show {
    opacity: 1;
    transform: translateY(0);
}

.scroll-top:hover {
    transform: translateY(-5px);
    background: var(--accent-hover);
}