/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* Контейнер */
.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

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

/* Заголовок */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 600;
}

.header p {
    font-size: 14px;
    opacity: 0.9;
}

/* Форма */
.form-container {
    padding: 30px 20px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label.required::after {
    content: ' *';
    color: #e74c3c;
}

.form-group small {
    display: block;
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 6px;
}

.form-group small a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.form-group small a:hover {
    text-decoration: underline;
}

.form-group small .warning {
    background-color: #fff3cd;
    padding: 4px 8px;
    border-radius: 4px;
    color: #856404;
    font-weight: 500;
}

/* Инпуты */
input[type="text"],
input[type="url"],
input[type="date"],
input[type="number"],
select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background-color: #f8f9ff;
}

input[type="text"]::placeholder,
input[type="url"]::placeholder {
    color: #bdc3c7;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* Группа датой ввода */
.date-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.days-input {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.days-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.days-label {
    font-size: 13px;
    color: #7f8c8d;
    font-weight: 500;
    white-space: nowrap;
}

.calculate-btn {
    padding: 12px 20px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.calculate-btn:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Переключатель типа печати */
.print-type-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.print-type-selector input[type="radio"] {
    display: none;
}

.print-type-option {
    flex: 1;
    padding: 16px;
    background: #f8f9fa;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.print-type-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
    color: #667eea;
}

.print-type-selector input[type="radio"]:checked + .print-type-option {
    background: #667eea;
    border-color: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.date-field {
    width: 100%;
}

#dateInfo {
    color: #27ae60;
    font-weight: 500;
}

/* Загрузка файлов */
.file-upload {
    position: relative;
    margin-bottom: 12px;
}

.file-input {
    display: none;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed #bdc3c7;
    border-radius: 12px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.file-label:hover {
    border-color: #667eea;
    background: #f0f3ff;
}

.file-label.dragover {
    border-color: #667eea;
    background: #f0f3ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.file-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.file-text {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
}

/* Список файлов */
.files-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #ecf0f1;
    border-radius: 8px;
    font-size: 13px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.file-item-name {
    flex: 1;
    color: #2c3e50;
    font-weight: 500;
    word-break: break-all;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 4px 8px;
}

.quantity-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background: #5568d3;
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-label {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.file-item-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s ease;
}

.file-item-remove:hover {
    background: #c0392b;
}

/* Кнопки */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-icon {
    font-size: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #bdc3c7;
}

/* Сообщения */
.message {
    padding: 16px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    margin-top: 16px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.message-text {
    flex: 1;
    font-weight: 500;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #f5c6cb;
}

/* Лоадер */
.loading {
    display: inline-block;
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    animation: blink 1.4s infinite;
    margin-left: 4px;
}

.loading:nth-child(1) {
    animation-delay: 0s;
}

.loading:nth-child(2) {
    animation-delay: 0.2s;
}

.loading:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

/* Адаптивность */
@media (max-width: 480px) {
    .container {
        border-radius: 12px;
    }

    .header {
        padding: 20px 15px;
    }

    .header h1 {
        font-size: 20px;
    }

    .form-container {
        padding: 20px 15px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .date-input-group {
        flex-wrap: wrap;
    }

    .calculate-btn {
        flex: 1;
        min-width: 100px;
    }

    .file-label {
        padding: 30px 15px;
    }
}

/* ==================== СТАТУС МАТЕРИАЛА ==================== */

.material-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.material-selector select {
    flex: 1;
}

.material-status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.material-status-badge.status-available {
    background: #e8f5e9;
    color: #2e7d32;
}

.material-status-badge.status-unavailable {
    background: #ffebee;
    color: #c62828;
}
