/* CSS стили для основного приложения - унифицированный дизайн */

/* Импорт общих стилей */
@import url('common.css');

/* Стили для формы входа */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #00154C;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.login-overlay.show {
    display: flex;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: slideUp 0.5s ease-out;
}

.login-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.login-description {
    color: #666;
    margin-bottom: 30px;
    font-size: 16px;
}

.login-form {
    width: 100%;
}

.login-form::placeholder {
    text-align: center;
}

.password-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fafafa;
    margin-bottom: 20px;
    text-align: center;
}

.password-input:focus {
    outline: none;
    border-color: #4285f4;
    background: white;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.password-input::placeholder {
    color: #999;
}

.login-btn {
    width: 100%;
    background: #00154C;
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.login-btn:hover {
    background: #aa884a;
}

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

.login-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.error-message {
    background: #fee;
    color: #c53030;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
    border: 1px solid #fed7d7;
    display: none;
    animation: shake 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

/* Уважайте настройки доступности */
@media (prefers-reduced-motion: reduce) {
  .typing-caret::after { animation: none; }
}

/* Скрываем основной контент при показе формы входа */
.main-content {
    display: none;
}

.main-content.authenticated {
    display: block;
}




.container-brief {
    background: white;
    border-radius: 16px;
}



/* Контейнер для блоков в одну строку */
.template-and-upload-container {
    display: flex;
    gap: 20px;
    margin: 30px 30px 0px 30px;
    align-items: stretch; /* Одинаковая высота */
}

/* Стили для блока выбора шаблона */
.template-selector {
    background: #00a3e0;
    color: white;
    padding: 20px;
    border-radius: 12px;
    display: none;
    flex: 1; /* Занимает равную долю */
    height: 90px;
}

/* Стили для DOCX загрузчика */
.docx-upload-selector {
    background: transparent;
    color: #000;
    border-radius: 6px;
    display: inline-block;
    flex: none; /* Не растягивается */
}

.template-label {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 18px;
    margin-bottom: 15px;
}

.template-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;   
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    transition: all 0.3s ease;
  height: 100%;
}

.template-select:focus {
    outline: none;
    border-color: white;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.template-select option {
    padding: 10px;
    background: white;
    color: #333;
}

.docx-upload-header {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
}

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

.docx-upload-title {
    color: #333;
}

.docx-upload-label {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    cursor: pointer;
    outline: none;
    width: auto;
    height: auto;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.docx-upload-label:focus {
    outline: none;
}

.docx-upload-area {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: auto;
    height: auto;
    min-height: auto;
    text-align: left;
    position: relative;
}

.docx-upload-area:hover {
    background: #f0f7ff;
    border-color: #cfd8e3;
    text-decoration: none;
    color: #333;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.docx-upload-area.drag-over {
    background: #f0f7ff;
    border-color: #4285f4;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.2);
}

.docx-file-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 8px auto;
    display: block;
    transition: opacity 0.3s ease;
}

.docx-icon {
    display: inline-block;
    width: 22px; /* Уменьшаем иконку для соответствия стилю status-link */
    height: 22px;
    background-image: url("https://upload.wikimedia.org/wikipedia/commons/f/fb/.docx_icon.svg");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    vertical-align: middle;
}



.docx-file-format {
    font-weight: 500;
    color: #333;
    font-size: 16px;
    margin: 0; /* Убираем margin для лучшего центрирования */
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.docx-upload-hint {
    display: none; /* Скрываем подсказку в новом компактном стиле */
    color: #666;
    font-size: 16px;
    font-weight: 500;
    margin-top: 4px;
    text-align: center;
    opacity: 0.7;
}

.docx-upload-area:hover .docx-upload-hint {
    opacity: 1;
}

.docx-file-input {
    display: none;
}

.docx-processing-status {
  padding: 0px;    
  position: fixed; 
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  box-shadow: none;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: pre-line;
}

.docx-processing-status.show {
  opacity: 1;
  transform: scale(1);
}

.docx-processing-status.hide {
  opacity: 0;
  transform: scale(0.95);
}


.docx-processing-status.success {
    background: rgba(34, 197, 94, 0.95);
    color: white;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.docx-processing-status.error {
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.docx-processing-status.processing {
    background: rgba(59, 130, 246, 0.95);
    color: white;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.docx-processing-status.info {
    background: rgba(255, 255, 255, 0.95);
    color: #374151;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.docx-processing-status .close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: inherit;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.docx-processing-status .close-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 40px;
    font-weight: 900;
    color: #333;

}

.form-content {
    padding: 30px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

.form-subtitle {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
    font-weight: normal;
}



.deadline-group {
    display: flex;
    gap: 15px;
}

.deadline-input {
    flex: 0 0 110px;
}

.deadline-input input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.deadline-comment {
    flex: 1;
}

.deadline-comment input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.links-row {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.links-row textarea {
    flex: 2;
}

.links-row .file-upload {
    margin: 0;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 2;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    background: #fafafa;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #4285f4;
    background: white;
}

textarea {
    min-height: 150px;
    resize: vertical;
}

.file-upload {
    min-height: 150px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 5px;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.file-upload:hover,
.file-upload.drag-over {
    border-color: #4285f4;
    background: #f0f7ff;
}

.file-upload.drag-over {
    border-style: solid;
    transform: scale(1.02);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload-text {
    color: #666;
    font-size: 14px;
}

.file-upload-icon {
    margin-bottom: 8px;
    font-size: 24px;
    color: #999;
}

.selected-files {
    margin-top: 10px;
    padding: 10px;
    background: #f0f7ff;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.file-item:last-child {
    border-bottom: none;
}

.file-content {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 15px;
}

.file-preview {
    width: 100px;
    height: 100px;
    border-radius: 4px;
    object-fit: cover;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
    flex-shrink: 0;
}

.file-preview img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    object-fit: cover;
}

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

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    color: #666;
    font-size: 12px;
}

.file-type {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
}

.remove-file {
    color: #e0e0e0;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 30px;
}

.remove-file:hover {
    color: #dc3545;
}

.contact-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    font-size: 16px;
}

.submit-btn {
    width: 100%;
    background: #00154C;
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.submit-btn:hover {
    background: #aa884a;
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.test-btn {
    background: #28a745;
    margin-top: 10px;
    display: none;
    font-size: 16px;
    font-weight: 500;
}

.test-btn:hover {
    background: #218838;

}

.loading {
    display: none;
    font-size: 18px;
    animation: spin 1s linear infinite;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* Анимации появления */

@keyframes taskAppear {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    60% {
        opacity: 0.8;
        transform: translateY(-3px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Стили для прогресс-бара */
.progress-container {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.progress-title {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.progress-stats {
    color: #666;
    font-size: 14px;
}

.progress-bar-container {
    background: #e9ecef;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00154C, #00a3e0);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
}

.progress-current-file-text {
    color: #666;
    font-size: 14px;
}

.progress-current-file {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    min-height: 20px;
    display: none;
}

.progress-file-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
    display: none;
}

.progress-file-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.progress-file-item.success {
    border-color: #28a745;
    background: #f8fff9;
}

.progress-file-item.error {
    border-color: #dc3545;
    background: #fff8f8;
}

.progress-file-item.uploading {
    border-color: #007bff;
    background: #f0f8ff;
}

.progress-file-icon {
    width: 20px;
    text-align: center;
    margin-right: 10px;
}

.progress-file-name {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-file-status {
    font-size: 12px;
    color: #666;
    margin-left: 10px;
}

.progress-file-item.success .progress-file-status {
    color: #28a745;
}

.progress-file-item.error .progress-file-status {
    color: #dc3545;
}

.progress-file-item.uploading .progress-file-status {
    color: #007bff;
}

.success-message,
.error-message {
    width: 100%;
    padding: 16px 20px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 15px;
    display: none;
    text-align: center;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

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

.action-buttons {
    display: none;
    margin-top: 15px;
    gap: 15px;
    justify-content: center;
}

.action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.new-brief-btn {
    width: 100%;
    background: #28a745;
    color: white;
}

.new-brief-btn:hover {
    background: #218838;
}

.retry-btn {
    background: #dc3545;
    color: white;
}

.retry-btn:hover {
    background: #c82333;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group-contact {
    display: flex;
    flex-direction: column;
    margin-bottom: 5px;
}

.form-group-contact label {
    margin-bottom: 6px;
    font-size: 14px;
}

.save-options {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    width: 100%;
    font-size: 11px;
    color: #155724;
    text-transform: uppercase;
}

.save-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.save-checkbox {
    margin: 5px;
    transform: scale(1.5);
    cursor: pointer;
}

/* Адаптивность */
@media (max-width: 768px) {


    /* Адаптивность для блоков шаблона и загрузки */
    .template-and-upload-container {
        flex-direction: column;
        margin: 10px;
        gap: 10px;
    }

    .template-selector,
    .docx-upload-selector {
        margin: 0;
    }

    .docx-upload-header {
        font-size: 16px;
    }

    .docx-upload-area {
        padding: 8px 16px;
        font-size: 16px;
    }

    .docx-file-icon {
        width: 18px;
        height: 18px;
    }

    .docx-file-format {
        font-size: 16px;
    }

    .docx-upload-hint {
        font-size: 16px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 0;
        box-shadow: none;
    }
    
    .login-container {
        margin: 20px;
        padding: 30px 20px;
    }
    
    .header,
    .form-content {
        padding: 20px;
    }
    
    .contact-section {
        padding: 15px 20px;
        margin: 0 -20px;
    }

    h1 {
        font-size: 25px;
        font-weight: 900;
        color: #333;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 24px;
    }

    .header-subtitle {
        font-size: 14px;
    }
}


/* === Action buttons modifiers (added) === */
.action-buttons.show { /* ensure visible */
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
  flex-wrap: wrap;
}

.action-btn--primary {
  background: #f8f9fa;
  color: #333;
  border: 1px solid #e0e0e0;
  flex: 1;
}
.action-btn--primary:hover {
  background: #f0f7ff;
  border-color: #cfd8e3;
}

.action-btn--secondary {
  background: #f8f9fa;
  color: #333;
  border: 1px solid #e0e0e0;
    flex: 1;
}
.action-btn--secondary:hover {
  background: #f0f7ff;
  border-color: #cfd8e3;
}

.action-btn--ghost {
  background: #f8f9fa;
  color: #333;
  border: 1px solid #e0e0e0;
    flex: 1;
}
.action-btn--ghost:hover {
  background: #f0f7ff;
  border-color: #cfd8e3;
}

/* Force visibility for action buttons */
.action-buttons.show { 
    display: flex;
}

.status-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.status-link:hover {
    background: #f0f7ff;
    border-color: #cfd8e3;
    text-decoration: none;
    color: #333;
}

/* Стиль для ссылки в сообщении об успехе */
.success-message-link {
    color: #155724;
    text-decoration: underline;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.success-message-link:hover {
    color: #0d4a1a;
    text-decoration: none;
}

.success-message-link:visited {
    color: #155724;
}

/* Стили для заголовков h2 */
h2 {
    font-size: 20px;
    color: #155724;
    margin: 0;
    line-height: 1.2;
}
