* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0088cc;
    --primary-hover: #006ba3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --bg-color: #1a1a1a;
    --surface-color: #2d2d2d;
    --border-color: #404040;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.5);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    padding: 16px;
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 20px;
}

header {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-primary);
}

header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
}

.balance-section {
    margin-bottom: 24px;
}

.balance-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.balance-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.balance-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.balance-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.btn-topup {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-topup:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-topup:active {
    transform: translateY(0);
}

.upload-section {
    margin-bottom: 24px;
}

.upload-area {
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--surface-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--surface-color);
    transform: scale(1.02);
}

.upload-content svg {
    color: var(--primary-color);
    margin-bottom: 16px;
}

.upload-content p {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

.files-section {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.file-count {
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--surface-color);
    padding: 4px 12px;
    border-radius: 20px;
}

.files-list {
    min-height: 100px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--surface-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.file-item:hover {
    background: #3a3a3a;
    transform: translateX(4px);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    font-size: 18px;
}

.btn-delete {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-delete:hover {
    background: #c82333;
    transform: scale(1.05);
}

.action-section {
    margin-bottom: 24px;
}

.calculation-cost {
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.calculation-cost strong {
    color: var(--primary-color);
    font-weight: 600;
}

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 16px 24px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.result-section {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.result-section h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.result-content {
    background: var(--surface-color);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.result-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 18px;
}

.result-warning {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(255, 193, 7, 0.15);
    border-left: 4px solid #ffc107;
    border-radius: var(--radius-sm);
    color: #ffc107;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* Адаптивность */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    header h1 {
        font-size: 28px;
    }

    .balance-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .balance-info {
        text-align: center;
    }

    .btn-topup {
        width: 100%;
        justify-content: center;
    }

    .upload-area {
        padding: 24px 12px;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .file-actions {
        width: 100%;
    }

    .btn-delete {
        width: 100%;
        justify-content: center;
    }
}

/* Анимация появления файлов */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-item {
    animation: fadeIn 0.3s ease;
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}

.modal-content {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.modal-text {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-modal-cancel,
.btn-modal-ok {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-cancel {
    background: var(--surface-color);
    color: var(--text-primary);
}

.btn-modal-cancel:hover {
    background: #3a3a3a;
}

.btn-modal-ok {
    background: var(--primary-color);
    color: white;
}

.btn-modal-ok:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

