* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0a0a0a;
    min-height: 100vh;
    padding: 16px;
}


.login{
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #0a0e1a 0%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
    align-items: center;
}
.login-input-wrapper {
    display: flex;
    align-items: center;
    background: #1e293b;
    border-radius: 60px;
    border: 2px solid #872323;
    transition: all 0.2s;
}

.login-input-wrapper:focus-within {
    border-color: #fc1a1a;
    box-shadow: 0 0 0 3px rgba(246, 59, 59, 0.2);
}

.login-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 20px;
    font-size: 1rem;
    color: #f1f5f9;
    outline: none;
    border-radius: 60px;
}

.login-input-wrapper input::placeholder {
    color: #64748b;
}

.login-container {
    max-width: 400px;
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 40px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 32px 24px 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}




.container {
    max-width: 650px;
    margin: 0 auto;
}

.card {
    background: #1e1e1e;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    border: 1px solid #2d2d2d;
}

h1 {
    color: #fff;
    margin-bottom: 6px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.subtitle {
    color: #888;
    margin-bottom: 20px;
    font-size: 13px;
}

.upload-area {
    border: 2px dashed #3a3a3a;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #252525;
}

.upload-area:hover {
    border-color: #667eea;
    background: #2a2a2a;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #2d2d35;
}

.upload-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.upload-text {
    color: #ccc;
    margin-bottom: 6px;
    font-size: 14px;
}

.upload-hint {
    font-size: 11px;
    color: #666;
}

#fileInput {
    display: none;
}

.btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 16px;
    width: 100%;
}

.btn:hover:not(:disabled) {
    background: #5a6fd6;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.preview {
    margin-top: 20px;
    text-align: center;
}

.preview img {
    max-width: 100%;
    max-height: 180px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.result {
    margin-top: 20px;
}

.section {
    background: #252525;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #333;
}

.section h4 {
    color: #fff;
    font-size: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.preview-item {
    flex: 1;
    text-align: center;
}

.preview-item p {
    color: #888;
    font-size: 12px;
    margin-bottom: 8px;
}

.preview-item img {
    max-height: 100px;
    border-radius: 6px;
}

.formula-box {
    background: #1a1a1a;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    border: 1px solid #333;
}

.formula-box code {
    color: #7ee787;
    word-break: break-all;
    flex: 1;
    font-size: 12px;
}

.copy-btn {
    background: #3a3a3a;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #4a4a4a;
}

.url-box {
    background: #1a1a1a;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #7ee787;
    word-break: break-all;
    border: 1px solid #333;
}

.url-label {
    color: #888;
    font-size: 11px;
    margin-bottom: 4px;
}

.success {
    color: #7ee787;
    background: #1a3a1a;
    padding: 10px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 13px;
    border: 1px solid #2a5a2a;
}

.error {
    color: #ff9e9e;
    background: #3a1a1a;
    padding: 10px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 13px;
    border: 1px solid #5a2a2a;
}

.loading {
    display: none;
    text-align: center;
    margin-top: 20px;
}

.spinner {
    border: 3px solid #3a3a3a;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.link-icon {
    font-size: 12px;
    margin-right: 4px;
}

hr {
    border-color: #333;
    margin: 12px 0;
}

/* Компактные стили для формул */
.compact-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

@media (max-width: 500px) {
    .preview-row {
        flex-direction: column;
        gap: 12px;
    }
    .formula-box {
        flex-direction: column;
        align-items: flex-start;
    }
    .copy-btn {
        align-self: flex-end;
    }
    .card {
        padding: 16px;
    }
    .upload-area {
        padding: 20px;
    }
}





.pages-block{
    position: absolute;
    display: flex;
    color: #fff;
    left: 10px;
    flex-direction: column;
    top: 10px;
    background-color: #0f172a;
    padding: 10px;
    border-radius: 10px;
    width: 160px;

}
.pages-title{
    color: #fff;
    text-align: center;
}
.pages-block a{
    display: flex;
    text-decoration: none;
    color: #fff;
    cursor: pointer;
    margin-top: 5px;
    padding: 5px;
    background-color: #1b153b;
    width: auto;
    align-items: center;
    border: 1px solid #29215c;
    border-radius: 5px;
}
.pages-block a span{
    margin-right: 5px;
    color: #2563eb;
}
@media (max-width: 1020px) {
    body{
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 10px;
        gap: 5px;
    }
    .card{
        margin-top: 10px;
    }
    .pages-block{
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        width: auto;
        position: inherit;
        align-items: center;
        gap: 5px;
    }
    .pages-block a {
        margin-top: 0;
        margin-left: 5px;
    }
}