header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--color-background-secondary);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    flex-wrap: wrap;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo-link:hover {
    transform: scale(1.05);
}

.site-logo {
    height: 52px;
    width: 52px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--color-input-background);
    padding: 6px;
    box-shadow: 0 4px 12px var(--color-shadow);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.site-logo:hover {
    box-shadow: 0 6px 20px var(--color-shadow-large);
    transform: translateY(-2px);
}

.header-center {
    flex: 1 1 300px;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.logo {
    font-weight: 700;
    font-size: 22px;
    color: var(--color-accent);
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.subtitle {
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.lang-select {
    background: var(--color-input-background);
    color: var(--color-text-primary);
    border: 1px solid var(--color-input-border);
    padding: 8px 32px 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-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='%23888' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    transition: all 0.2s ease;
}

.lang-select:hover {
    border-color: var(--color-blue);
    background-color: var(--color-background-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--color-shadow);
}

.lang-select:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px var(--color-blue-alpha-20);
}

.lang-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.theme-toggle {
    background: var(--color-input-background);
    border: 1px solid var(--color-input-border);
    color: var(--color-text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    border-color: var(--color-blue);
    background-color: var(--color-background-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--color-shadow);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle .icon-dark,
.theme-toggle .icon-light {
    transition: all 0.3s ease;
}

:root:not(.light-theme) .theme-toggle .icon-dark {
    display: inline-block;
}

:root.light-theme .theme-toggle .icon-light {
    display: inline-block;
}

:root:not(.light-theme) .theme-toggle .icon-light {
    display: none;
}

:root.light-theme .theme-toggle .icon-dark {
    display: none;
}

.panel {
    background: var(--color-background-secondary);
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 16px var(--color-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    position: relative;
}

.panel:hover {
    box-shadow: 0 8px 24px var(--color-shadow-large);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--color-panel-header-bg);
    border-bottom: 1px solid var(--color-border);
    gap: 12px;
    flex-wrap: wrap;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text-primary);
}

.panel-title i {
    color: var(--color-accent);
    font-size: 16px;
}

.panel-footer {
    padding: 12px 20px;
    background: var(--color-panel-header-bg);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.textarea-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
    overflow: hidden;
}

textarea {
    flex-grow: 1;
    width: 100%;
    min-height: 400px;
    background: var(--color-input-background);
    color: var(--color-text-primary);
    border: none;
    resize: none;
    padding: 16px 16px 16px 60px;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    transition: background-color 0.2s ease;
    tab-size: 4;
    -moz-tab-size: 4;
}

textarea:focus {
    background-color: var(--color-input-background-focus);
}

textarea::placeholder {
    color: var(--color-text-placeholder);
    opacity: 0.6;
}

textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 100%;
    padding: 16px 8px;
    background: var(--color-line-numbers-bg);
    border-right: 1px solid var(--color-border);
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--color-text-tertiary);
    text-align: right;
    user-select: none;
    overflow: hidden;
    pointer-events: none;
}

.line-number {
    min-height: 22.4px;
    transition: color 0.2s ease;
}

textarea:focus ~ .line-numbers .line-number {
    color: var(--color-text-secondary);
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

button {
    background: var(--color-blue);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before {
    width: 300px;
    height: 300px;
}

button i {
    font-size: 14px;
    position: relative;
    z-index: 1;
}

button span {
    position: relative;
    z-index: 1;
}

button:hover {
    background-color: var(--color-blue-darker);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--color-blue-alpha-30);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px var(--color-blue-alpha-20);
}

button.btn-primary {
    background: linear-gradient(135deg, var(--color-blue), var(--color-blue-darker));
}

button.btn-secondary {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

button.btn-secondary:hover {
    background-color: var(--color-input-background);
    border-color: var(--color-blue);
    box-shadow: 0 4px 12px var(--color-shadow);
}

button.btn-success {
    background: var(--color-green);
}

button.btn-success:hover {
    background: var(--color-green-darker);
}

button.btn-error {
    background: var(--color-red);
}

button.btn-error:hover {
    background: var(--color-red-darker);
}

button:disabled,
button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
}

button .fa-spinner {
    animation: spin 1s linear infinite;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--color-status-bg);
    transition: all 0.3s ease;
}

.status i {
    flex-shrink: 0;
    font-size: 14px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

.progress-bar {
    flex-grow: 1;
    height: 20px;
    background: var(--color-input-background);
    border: 1px solid var(--color-input-border);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-green), var(--color-accent));
    border-radius: 10px;
    width: 0;
    position: relative;
    overflow: hidden;
}

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

.progress-text {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-weight: 600;
    min-width: 60px;
    text-align: right;
    font-family: 'Fira Code', 'Consolas', monospace;
}

.footer {
    padding: 16px 24px;
    background: var(--color-panel-header-bg);
    border-top: 1px solid var(--color-border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.note {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.note i {
    color: var(--color-accent);
    flex-shrink: 0;
}

.footer-info {
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.footer-info a {
    text-decoration: none;
    color: var(--color-accent);
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer-info a:hover,
.footer-info a:focus {
    color: var(--color-blue);
    text-decoration: underline;
}

.swal-modern {
    border-radius: 12px !important;
    padding: 24px !important;
}

.swal-title {
    font-size: 20px !important;
    font-weight: 700 !important;
}

.swal-content {
    font-size: 14px !important;
    line-height: 1.6 !important;
}

.swal-button {
    border-radius: 8px !important;
    padding: 10px 24px !important;
    font-weight: 600 !important;
}

@media (max-width: 768px) {
    header {
        padding: 12px 16px;
    }

    .header-content {
        gap: 12px;
    }

    .site-logo {
        height: 44px;
        width: 44px;
    }

    .logo {
        font-size: 18px;
    }

    .subtitle {
        font-size: 12px;
    }

    .panel-header,
    .panel-footer {
        padding: 12px 16px;
    }

    textarea {
        min-height: 300px;
        padding: 12px 12px 12px 50px;
        font-size: 13px;
    }

    .line-numbers {
        width: 45px;
        padding: 12px 6px;
        font-size: 12px;
    }

    button {
        padding: 8px 14px;
        font-size: 12px;
    }

    button span {
        display: none;
    }

    .footer {
        padding: 12px 16px;
    }

    .note,
    .footer-info {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .header-controls {
        width: 100%;
        justify-content: flex-end;
    }

    .controls {
        width: 100%;
        justify-content: flex-start;
    }

    .progress-container {
        width: 100%;
    }
}