body {
    font-family: sans-serif;
    background-color: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, #000);
    padding: 20px;
    text-align: center;
    margin: 0;
}

.card {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.balance {
    font-size: 28px;
    font-weight: bold;
    color: var(--tg-theme-button-color, #2481cc);
    margin: 10px 0;
}

.cost {
    font-size: 12px;
    opacity: 0.7;
}

input[type="file"] {
    margin: 15px 0;
    width: 100%;
}

/* Кастомная кнопка загрузки файла */
.upload-label {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff !important;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 15px 0;
    font-weight: bold;
    font-size: 16px;
    text-align: center;
}

.upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.upload-label:active {
    transform: translateY(0);
}

.upload-icon {
    font-size: 24px;
}

.file-name {
    text-align: center;
    padding: 8px;
    margin: 10px 0;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    font-size: 14px;
    color: var(--tg-theme-text-color, #000);
}

.file-name:empty {
    display: none;
}

button.local-btn {
    width: 100%;
    padding: 14px;
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

button.local-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(36, 129, 204, 0.3);
}

button.local-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

img {
    max-width: 100%;
    border-radius: 10px;
    margin-top: 15px;
    border: 1px solid rgba(0,0,0,0.1);
}

#result-area {
    display: none;
}

.loader {
    display: none;
    border: 4px solid rgba(0,0,0,0.1);
    border-top: 4px solid var(--tg-theme-button-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Статус обработки */
.process-status {
    text-align: center;
    font-size: 14px;
    color: var(--tg-theme-button-color, #2481cc);
    font-weight: bold;
    margin: 10px 0;
    min-height: 20px;
}

.process-status:empty {
    display: none;
}

/* История */
.history-item {
    background: rgba(0,0,0,0.05);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(0,0,0,0.08);
    transform: translateX(4px);
}

.history-item img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 10px;
    margin: 0;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.history-item img:hover {
    transform: scale(1.05);
}

.history-item-info {
    flex: 1;
    text-align: left;
}

.history-date {
    font-size: 14px;
    font-weight: bold;
    color: var(--tg-theme-text-color, #000);
    text-transform: capitalize;
}

.history-id {
    font-size: 12px;
    color: var(--tg-theme-button-color, #2481cc);
    opacity: 0.8;
    margin-top: 4px;
}

.history-send-btn {
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(36, 129, 204, 0.3);
}

.history-toggle {
    background: transparent;
    color: var(--tg-theme-button-color, #2481cc);
    border: 1px solid var(--tg-theme-button-color, #2481cc);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-toggle:hover {
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    transform: translateY(-1px);
}

#history-container.collapsed {
    visibility: hidden;
    height: 0;
    overflow: hidden;
}

/* Modal для просмотра фото */
.photo-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.photo-modal.active {
    display: flex;
}

.photo-modal-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.photo-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    color: #fff;
    border: none;
    font-size: 32px;
    cursor: pointer;
    padding: 5px 10px;
}

.photo-modal-close:hover {
    color: #ccc;
}

.photo-modal-actions {
    margin-top: 15px;
}

.photo-modal-btn {
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.photo-modal-btn:hover {
    opacity: 0.9;
}
