* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: #F5F5F5;
    color: #333333;
    line-height: 1.6;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

body.visible {
    opacity: 1;
}

body:not(.visible) {
    animation: fadeIn 1s ease-in-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: 1600px;
    gap: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    flex: 0 1 auto;
}

.topnav {
      overflow: hidden;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      padding: 10px 20px;
      line-height: normal;
      background: #ffffff;
    }

    .topnav a {
      float: left;
      display: block;
      color: #1e3a8a;
      text-align: center;
      padding: 14px 18px;
      text-decoration: none;
      font-size: 16px;
      font-weight: 500;
      position: relative;
      transition: color 0.3s ease, transform 0.2s ease;
    }

    .topnav a:hover {
      /*color: #3b82f6;
      transform: scale(1.05);*/
    }

    .topnav a::after {
      content: '';
      position: absolute;
      width: 0;
      height: 2px;
      bottom: 8px;
      left: 18px;
      background-color: #0056b3;
      transition: width 0.3s ease;
    }

    .topnav a:hover::after, .topnav a.active::after {
      width: calc(100% - 36px);
    }

    .topnav .active {
      color: #0056b3;
      font-weight: 600;
    }

    .topnav .icon {
      display: none;
      font-size: 22px;
      color: #1e3a8a;
    }

    .topnav .right {
      float: right;
    }

    /* Dropdown styles */
    .dropdown {
      float: left;
      overflow: hidden;
    }

    .dropdown .dropbtn {
      font-size: 16px;
      font-weight: 500;
      border: none;
      outline: none;
      color: #1e3a8a;
      padding: 14px 18px;
      background-color: transparent;
      font-family: inherit;
      margin: 0;
      cursor: pointer;
      position: relative;
      transition: color 0.3s ease, transform 0.2s ease;
    }

    .dropdown:hover .dropbtn, .dropdown.active .dropbtn {
      /*color: #3b82f6;
      transform: scale(1.05);*/
    }

    .dropdown .dropbtn::after {
      content: '';
      position: absolute;
      width: 0;
      height: 2px;
      bottom: 8px;
      left: 18px;
      background-color: #3b82f6;
      transition: width 0.3s ease;
    }

    .dropdown:hover .dropbtn::after, .dropdown.active .dropbtn::after {
      /*width: calc(100% - 36px);*/
    }

    .dropdown-content {
      display: none;
      position: absolute;
      background-color: #ffffff;
      min-width: 180px;
      box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
      border-radius: 6px;
      z-index: 1;
      opacity: 0;
      transform: translateY(-10px);
      transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .dropdown:hover .dropdown-content, .dropdown.active .dropdown-content {
      display: block;
      opacity: 1;
      transform: translateY(0);
    }

    .dropdown-content a {
      float: none;
      color: #1e3a8a;
      padding: 12px 18px;
      text-decoration: none;
      display: block;
      text-align: left;
      font-size: 14px;
      font-weight: 400;
      transition: color 0.3s ease, background-color 0.3s ease, padding-left 0.3s ease;
    }

    .dropdown-content a:hover {
      color: #0056b3;
      background-color: #f8fafc;
      /*padding-left: 22px;*/
    }

.side-banner {
    width: 160px;
    background: #F0F0F0;
    padding: 10px;
    text-align: center;
    border-radius: 8px;
    display: none;
    position: sticky;
    top: 20px;
    flex-shrink: 0;
    height: 600px;
    overflow: hidden;
}

.side-banner.left {
    order: -1;
}

.side-banner.right {
    left: 20px;
}

header {
    background: #FFFFFF;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    text-align: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}

.logo {
    width: 100px;
    height: auto;
    opacity: 1;
    transition: opacity 1s ease-in-out;
}

.logo.fade-out {
    opacity: 0;
}

header h1 {
    font-size: 24px;
    font-weight: 700;
}

.banner {
    background: #F0F0F0;
    padding: 10px;
    text-align: center;
    margin: 20px 0;
    border-radius: 8px;
}

.content {
    background: #FFFFFF;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.progress-step {
    flex: 1;
    text-align: center;
    color: #666;
    font-size: 14px;
    margin: 0 5px;
    position: relative;
    padding-bottom: 5px;
    transition: border-bottom 0.2s ease, color 0.2s ease;
}

.progress-step i {
    margin-right: 5px;
}

.progress-step.active {
    color: #0056b3;
    font-weight: 500;
    border-bottom: solid 4px #0056b3;
}

.step {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    will-change: opacity, transform;
}

.step.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.step-instruction {
    font-size: 14px;
    color: #555555;
    margin-bottom: 15px;
}

.note {
    font-size: 12px;
    color: #777777;
    margin-top: 10px;
    font-style: italic;
}

h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 15px;
}

h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
    color: #444;
}

p {
    font-size: 14px;
    color: #444;
    transition: opacity 0.2s ease;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

input[type="file"], input[type="number"], select {
    padding: 8px;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    font-size: 16px;
    flex: 1;
    transition: border-color 0.2s ease;
}

input[type="file"]:focus, input[type="number"]:focus, select:focus {
    border-color: #007BFF;
    outline: none;
}

input.invalid {
    border-color: #FF4D4F;
}

.file-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #E0E0E0;
    gap: 10px;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.2s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-entry img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 4px;
    background-image: linear-gradient(45deg, #CCCCCC 25%, transparent 25%, transparent 75%, #CCCCCC 75%), linear-gradient(45deg, #CCCCCC 25%, transparent 25%, transparent 75%, #CCCCCC 75%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
}

.file-entry span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-entry input[type="number"] {
    width: 80px;
    flex: none;
}

.file-entry .controls {
    display: flex;
    gap: 5px;
}

.file-entry .controls button {
    padding: 5px;
    font-size: 14px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.file-entry .controls button:hover:not(:disabled) {
    transform: scale(1.1);
}

.file-entry:last-child {
    border-bottom: none;
}

.params-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #E0E0E0;
}

.params-section:last-child {
    border-bottom: none;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.params-grid label {
    display: flex;
    flex-direction: column;
    font-size: 14px;
    position: relative;
}

.params-grid label.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 5px;
}

.error-message {
    color: #FF4D4F;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

button {
    background: #007BFF;
    color: #FFFFFF;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

button:disabled {
    background: #B0BEC5;
    cursor: not-allowed;
}

button:hover:not(:disabled) {
    /*background: #0056b3;
    transform: scale(1.05);*/
}

button:active:not(:disabled) {
    transform: scale(0.98);
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.preview-container {
    max-width: 100%;
    margin-bottom: 20px;
}

#preview {
    width: 100%;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    background-image: linear-gradient(45deg, #CCCCCC 25%, transparent 25%, transparent 75%, #CCCCCC 75%), linear-gradient(45deg, #CCCCCC 25%, transparent 25%, transparent 75%, #CCCCCC 75%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
}

#preview.visible {
    opacity: 1;
}

#dimensions {
    font-size: 14px;
    color: #555555;
    margin-top: 10px;
}

.status {
    font-size: 14px;
    margin-top: 10px;
    transition: opacity 0.2s ease;
}

.error {
    color: #FF4D4F;
}

.success {
    color: #28A745;
}

.hint {
    font-size: 12px;
    color: #777777;
    margin-top: 5px;
}

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0,0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.lightbox.active {
    opacity: 1;
}

.lightbox-content {
    background: #000;
    padding: 20px;
    border-radius: 8px;
    color: #FFF;
    max-width: 600px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

#video_timer {
    font-size: 18px;
    margin-top: 10px;
}

#process_status {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#process_indicator {
    width: 30px;
    height: 30px;
}

#process_indicator.fade-out {
    opacity: 0;
}

#process_text {
    font-size: 14px;
    color: #FFF;
    transition: opacity 0.3s ease;
}

/* Onboarding Guide Styles */
.onboarding-guide {
    display: none;
    z-index: 2000;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.onboarding-guide.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.onboarding-card {
    background-color: #007bff;
    color: #ffffff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-width: 300px;
    min-width: 200px;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s ease, top 0.3s ease, left 0.3s ease;
}

.onboarding-card.hidden {
    opacity: 0;
    transform: translateY(10px);
}

.onboarding-card.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.onboarding-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
}

.onboarding-card p {
    margin: 0 0 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #ffffff;
}

.onboarding-card.with-highlight::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #007bff;
}

.onboarding-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.onboarding-button-text {
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    padding: 5px 10px;
}

.onboarding-button-text:hover {
    text-decoration: underline;
}

.onboarding-highlight {
    position: relative !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5) !important;
    z-index: 2001 !important;
    animation: pulse 1.5s ease-in-out infinite !important;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(0, 123, 255, 0.7);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
    }
}

/* Guide Toggle Styles */
.guide-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: #007BFF;
    color: #FFFFFF;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 1000;
    font-size: 14px;
    align-items: center;
    gap: 5px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.guide-toggle i {
    font-size: 16px;
}

.guide-toggle:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.guide-toggle:active {
    transform: scale(0.98);
}

button, .btn {
    background-color: #007bff;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

button:hover, .btn:hover {
    background-color: #0056b3;
}

@media (max-width: 768px) {
    .onboarding-card {
        max-width: 90vw;
        min-width: 150px;
        padding: 12px;
        font-size: 14px;
    }
    .onboarding-card h3 {
        font-size: 16px;
    }
    .onboarding-card p {
        font-size: 12px;
    }
    .onboarding-button-text {
        font-size: 12px;
    }
    .onboarding-highlight {
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5) !important;
    }
    .guide-toggle {
        top: 10px;
        right: 10px;
        padding: 6px 10px;
        font-size: 12px;
    }
    .guide-toggle i {
        font-size: 14px;
    }
    .wrapper {
        flex-direction: column;
        align-items: center;
    }
    .container {
        width: 100%;
    }
    .side-banner {
        display: none;
    }
    .progress-bar {
        flex-direction: column;
        gap: 8px;
    }
    .progress-step {
        margin: 0;
        padding: 8px;
        font-size: 12px;
    }
    .input-group {
        flex-direction: column;
    }
    .params-grid {
        grid-template-columns: 1fr;
    }
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    .file-entry {
        gap: 10px;
    }
    .file-entry input[type="number"] {
        width: 60px;
    }
    .file-entry img {
        width: 80px;
        height: 80px;
    }
    .file-entry .controls button {
        padding: 5px;
        font-size: 12px;
    }
    .progress-bar {
        flex-direction: row;
        line-height: normal;
    }
}

   /* Responsive styles */
    @media screen and (max-width: 600px) {
      .logo {
              width: 50px;
              }
      .topnav a:not(:first-child), .dropdown .dropbtn, .topnav a.right {
        display: none;
      }
      .topnav a.icon {
        float: right;
        display: block;
        position: relative;
        z-index: 2;
      }
      .topnav a::after {content: none;}
      .topnav.responsive {
        position: relative;
      }
      .topnav.responsive a {
        float: none;
        display: block;
        text-align: left;
        opacity: 0;
        transform: translateY(-10px);
        animation: slideIn 0.3s ease-out forwards;
        animation-delay: calc(var(--index) * 0.1s); /* Плавное появление пунктов */
      }
      .topnav.responsive a.right {
        display: block;
      }
      .topnav.responsive .dropdown {
        float: none;
        display: block;
        opacity: 0;
        transform: translateY(-10px);
        animation: slideIn 0.3s ease-out forwards;
        animation-delay: calc(var(--index) * 0.1s);
      }
      .topnav.responsive .dropdown .dropbtn {
        display: block;
        width: 100%;
        text-align: left;
      }
      .topnav.responsive .dropdown-content {
        position: relative;
        box-shadow: none;
        border-radius: 0;
        background-color: #f8fafc;
        display: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
      }
      .topnav.responsive .dropdown.active .dropdown-content {
        display: block;
        max-height: 500px; /* Достаточно для всех подпунктов */
      }
      .topnav.responsive .dropdown-content a {
        padding-left: 30px;
        opacity: 0;
        transform: translateY(-10px);
        animation: slideIn 0.3s ease-out forwards;
        animation-delay: calc(var(--index) * 0.1s);
      }
      .topnav.responsive .icon {
        position: absolute;
        right: 20px;
        top: 10px;
      }
      @keyframes slideIn {
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }
    }

@media (min-width: 1200px) {
    .side-banner {
        display: block;
    }
}

#progress_bar {
    width: 100%;
    height: 4px;
    background-color: #E0E0E0;
    position: relative;
    margin-top: 10px;
    border-radius: 4px;
    overflow: hidden;
}

#progress_fill {
    height: 100%;
    background-color: #007BFF;
    width: 0%;
    transition: width 0.3s ease-in-out;
}

/* Стили для превью страниц */
#page_preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.page-preview {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.page-preview:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.page-preview img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.page-preview.selected img {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);
}

.page-preview p {
    margin: 8px 0 0 0;
    font-size: 12px;
    text-align: center;
    color: #666;
    padding: 0 5px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Стили для номеров страниц */
.page-number {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #007bff;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 10;
    animation: numberAppear 0.3s ease-out;
}

