:root {
    --background-color: linear-gradient(to bottom, #BFE6D2, #78CFA9);
    --background-image: url('/static/images/Pic3.png');

    --text-color: #1F4736;

    --card-background: rgba(255, 255, 255, 0.92);
    --container-background: rgba(255, 255, 255, 0.92);

    --nav-background: #4F9F7C;
    --nav-text-color: white;

    --button-background: linear-gradient(to right, #78CFA9, #5FBF98);
    --button-hover-background: linear-gradient(to right, #5FBF98, #3F8F6C);

    --primary-color: #5FBF98;
    --secondary-color: #78CFA9;
    --accent-color: #BFE6D2;

    --button-gradient-start: #78CFA9;
    --button-gradient-end: #5FBF98;

    --button-hover-gradient-start: #5FBF98;
    --button-hover-gradient-end: #3F8F6C;

    --modal-background: rgba(0, 0, 0, 0.5);

    --upload-button-bg: #5FBF98;
    --upload-button-hover: #4A9F7C;
    --hr-color: rgba(31, 71, 54, 0.2);
    --file-select-border: #BFE6D2;
    --dropzone-bg: rgba(95, 191, 152, 0.05);
    --dropzone-border: #5FBF98;
}

html.dark-theme {
    --background-color: linear-gradient(to bottom, #2F5A47, #1F3F33);
    --background-image: url('/static/images/Pic3.png');

    --text-color: #EAF7F0;

    --card-background: rgba(31, 63, 51, 0.95);
    --container-background: rgba(31, 63, 51, 0.95);

    --nav-background: #1F3F33;
    --nav-text-color: #EAF7F0;

    --button-background: linear-gradient(to right, #4E8C6F, #3A6F57);
    --button-hover-background: linear-gradient(to right, #3A6F57, #2B4F3F);

    --primary-color: #6FBF97;
    --secondary-color: #4E8C6F;
    --accent-color: #2F5A47;

    --button-gradient-start: #4E8C6F;
    --button-gradient-end: #3A6F57;

    --button-hover-gradient-start: #3A6F57;
    --button-hover-gradient-end: #2B4F3F;

    --modal-background: rgba(0, 0, 0, 0.85);

    --upload-button-bg: #4E8C6F;
    --upload-button-hover: #3A6F57;
    --hr-color: rgba(111, 191, 151, 0.3);
    --file-select-border: #4E8C6F;
    --dropzone-border: #6FBF97;
}

body {
    background: var(--background-color);
    background-image: var(--background-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    font-family: 'Segoe UI', sans-serif;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.upload-container {
    max-width: 700px;
    margin: 100px auto 60px;
    padding: 0 20px;
}

.upload-header {
    text-align: center;
    margin-bottom: 35px;
    animation: fadeInUp 0.6s ease;
}

.header-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 20px rgba(95, 191, 152, 0.3);
}

.header-icon i {
    font-size: 32px;
    color: white;
}

.upload-header h1 {
    font-size: 32px;
    font-family: 'Great Vibes', cursive;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.upload-header p {
    font-size: 16px;
    color: var(--text-color);
    opacity: 0.8;
}

.upload-card {
    background: var(--container-background);
    border-radius: 28px;
    padding: 35px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.6s ease 0.1s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

.section-title i {
    font-size: 20px;
    color: var(--primary-color);
}

.section-title span {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.drop-zone {
    border: 2px dashed var(--dropzone-border);
    border-radius: 20px;
    padding: 40px 20px;
    text-align: center;
    background: var(--dropzone-bg);
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: var(--primary-color);
    background: rgba(95, 191, 152, 0.1);
}

.drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(95, 191, 152, 0.15);
    transform: scale(1.02);
}

.drop-zone-icon {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.drop-zone-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-color);
}

.drop-zone-subtext {
    font-size: 13px;
    color: var(--text-color);
    opacity: 0.6;
    margin-bottom: 20px;
}

.drop-zone input[type="file"] {
    display: none;
}

.file-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.file-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(95, 191, 152, 0.3);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--card-background);
    padding: 15px 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease;
}

.file-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    color: var(--primary-color);
}

.file-size {
    font-size: 12px;
    color: var(--text-color);
    opacity: 0.6;
}

.remove-file {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(244, 67, 54, 0.1);
    border: none;
    color: #f44336;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file:hover {
    background: #f44336;
    color: white;
    transform: rotate(90deg);
}

.upload-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(95, 191, 152, 0.3);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 30px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--hr-color);
}

.divider span {
    padding: 0 15px;
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.6;
}

.saved-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.saved-list::-webkit-scrollbar {
    width: 6px;
}

.saved-list::-webkit-scrollbar-track {
    background: var(--hr-color);
    border-radius: 3px;
}

.saved-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.saved-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--card-background);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.saved-item:hover {
    transform: translateX(5px);
    border-color: var(--primary-color);
    background: rgba(95, 191, 152, 0.05);
}

.saved-item.selected {
    border-color: var(--primary-color);
    background: rgba(95, 191, 152, 0.1);
}

.saved-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.saved-info {
    flex: 1;
}

.saved-info h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--primary-color);
}

.saved-info p {
    font-size: 12px;
    color: var(--text-color);
    opacity: 0.6;
}

.saved-arrow {
    color: var(--primary-color);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.saved-item:hover .saved-arrow {
    opacity: 1;
    transform: translateX(3px);
}

.empty-saved {
    text-align: center;
    padding: 40px 20px;
}

.empty-saved i {
    font-size: 48px;
    color: var(--primary-color);
    opacity: 0.4;
    margin-bottom: 15px;
}

.empty-saved p {
    font-size: 15px;
    color: var(--text-color);
    opacity: 0.7;
}

.empty-hint {
    font-size: 13px !important;
    margin-top: 8px;
}

.use-saved-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 12px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.use-saved-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(95, 191, 152, 0.3);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.loading-card {
    background: var(--card-background);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    max-width: 350px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 25px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    animation: spin 1.5s linear infinite;
}

.spinner-ring:nth-child(1) {
    border-top-color: var(--primary-color);
    animation-delay: 0s;
}

.spinner-ring:nth-child(2) {
    border-right-color: var(--secondary-color);
    animation-delay: 0.3s;
}

.spinner-ring:nth-child(3) {
    border-bottom-color: var(--accent-color);
    animation-delay: 0.6s;
}

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

.loading-card h3 {
    font-size: 22px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.loading-card p {
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 20px;
}

.loading-progress {
    background: rgba(95, 191, 152, 0.2);
    border-radius: 10px;
    height: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 60%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    animation: progress 1.5s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 768px) {
    .upload-container {
        margin: 80px auto 40px;
    }

    .upload-card {
        padding: 25px;
    }

    .upload-header h1 {
        font-size: 28px;
    }

    .drop-zone {
        padding: 30px 15px;
    }

    .drop-zone-text {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .upload-card {
        padding: 20px;
    }

    .upload-header h1 {
        font-size: 24px;
    }

    .header-icon {
        width: 55px;
        height: 55px;
    }

    .header-icon i {
        font-size: 24px;
    }

    .section-title span {
        font-size: 16px;
    }

    .saved-item {
        padding: 12px;
    }

    .saved-info h4 {
        font-size: 14px;
    }
}