/* ============================================
   Базовые стили
   ============================================ */

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* ============================================
   Layout
   ============================================ */

.page-section {
    padding: 40px 20px;
    min-height: calc(100vh - 80px);
}

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

.container.narrow {
    max-width: 640px;
}

.page-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.page-card h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 600;
    color: #111827;
}

.page-subtitle {
    margin: 0 0 24px 0;
    color: #6b7280;
    font-size: 15px;
}

/* ============================================
   Навигация (navbar)
   ============================================ */

.site-header {
    background-color: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: #3b82f6;
    color: white;
    font-weight: 700;
    font-size: 18px;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: #111827;
}

.nav-link.active {
    color: #111827;
    font-weight: 700;
}

/* ============================================
   Кнопки
   ============================================ */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
    text-align: center;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-primary:disabled {
    background-color: #93c5fd;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

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

.btn-full-width,
.full-width {
    width: 100%;
}

/* ============================================
   Формы
   ============================================ */

.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 40px 20px;
}

.auth-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-card h1 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    text-align: center;
}

.auth-subtitle {
    margin: 0 0 24px 0;
    color: #6b7280;
    font-size: 14px;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
}

.form-group input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

/* ============================================
   Dropzone
   ============================================ */

.dropzone-wrapper {
    position: relative;
}

.dropzone-wrapper .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dropzone {
    border: 2px dashed #6b7280;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #f9fafb;
    position: relative;
    z-index: 1;
}

.dropzone:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.dropzone.dragover {
    border-color: #3b82f6;
    background-color: #dbeafe;
}

.dropzone.has-file {
    border-color: #10b981;
    border-style: solid;
    background-color: #ecfdf5;
}

.dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.dropzone-icon {
    font-size: 48px;
}

.dropzone-button {
    position: relative;
    z-index: 10;
    display: inline-block;
    padding: 10px 24px;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    pointer-events: auto;
}

.dropzone-button:hover {
    background-color: #2563eb;
}

.dropzone-secondary {
    color: #6b7280;
    font-size: 14px;
}

/* ============================================
   Status boxes
   ============================================ */

.status-box {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.status-box.error {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.status-box.success {
    background-color: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.status-box.loading {
    background-color: #dbeafe;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.status-box.idle {
    background-color: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

/* ============================================
   Upload sections
   ============================================ */

.upload-section {
    margin-bottom: 24px;
}

.section-header {
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
}

.section-hint {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

.receiver-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.receiver-header .section-header {
    flex: 1;
    margin-bottom: 0;
}

#receiverSection {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.receiver-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.receiver-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.clear-file-button {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.clear-file-button:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

/* ============================================
   File preview
   ============================================ */

.file-preview {
    margin-top: 12px;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    position: relative;
}

.file-card-icon {
    font-size: 24px;
}

.file-card-body {
    flex: 1;
    min-width: 0;
}

.file-card-name {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    word-break: break-all;
}

.file-card-meta {
    font-size: 12px;
    color: #6b7280;
}

.file-card-clear {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-card-clear:hover {
    background: #dc2626;
    color: white;
}

/* ============================================
   Submit section
   ============================================ */

.submit-section {
    margin-top: 32px;
    text-align: center;
}

.button-loader {
    margin-left: 8px;
}

/* ============================================
   Error pages
   ============================================ */

.error-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 40px 20px;
}

.error-card {
    text-align: center;
    max-width: 400px;
}

.error-code {
    font-size: 72px;
    font-weight: 900;
    color: #dc2626;
    line-height: 1;
    margin-bottom: 16px;
}

.error-card h1 {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px 0;
}

.error-card p {
    color: #6b7280;
    margin: 0 0 24px 0;
}

/* ============================================
   Utility classes
   ============================================ */

.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}