* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.75rem;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: hsl(var(--foreground));
    min-height: 100vh;
    padding: 1.5rem;
    line-height: 1.6;
}

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

header {
    margin-bottom: 2rem;
    text-align: center;
    padding: 2rem 0;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(221.2 83.2% 45%) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    font-size: 1rem;
    color: hsl(var(--muted-foreground));
}

.tabs-container {
    margin-bottom: 2rem;
    background: hsl(var(--card));
    border-radius: var(--radius);
    padding: 0.5rem;
    box-shadow: var(--shadow);
    border: 1px solid hsl(var(--border));
}

.tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: calc(var(--radius) - 2px);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.tab-btn.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    box-shadow: var(--shadow);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 968px) {
    main {
        grid-template-columns: 1fr;
    }
}

section {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s;
}

section:hover {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: hsl(var(--foreground));
    letter-spacing: -0.025em;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: hsl(var(--foreground));
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

input[type="text"],
input[type="url"],
select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    transition: all 0.2s;
}

input[type="text"]:focus,
input[type="url"]:focus,
select:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
}

small {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.btn {
    padding: 0.625rem 1rem;
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: hsl(var(--primary) / 0.9);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-color: hsl(var(--border));
}

.btn-secondary:hover {
    background: hsl(var(--secondary) / 0.8);
}

.status-message {
    margin-top: 1rem;
    padding: 0.875rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    border: 1px solid;
}

.status-message.success {
    background: hsl(142.1 76.2% 36.3% / 0.1);
    color: hsl(142.1 70.6% 45.3%);
    border-color: hsl(142.1 76.2% 36.3% / 0.2);
}

.status-message.error {
    background: hsl(0 84.2% 60.2% / 0.1);
    color: hsl(0 72.2% 50.6%);
    border-color: hsl(0 84.2% 60.2% / 0.2);
}

.status-message.info {
    background: hsl(221.2 83.2% 53.3% / 0.1);
    color: hsl(221.2 83.2% 53.3%);
    border-color: hsl(221.2 83.2% 53.3% / 0.2);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.storage-content,
.history-content {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
    background: hsl(var(--background));
}

.file-item {
    padding: 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.file-item .file-date {
    white-space: nowrap;
    min-width: 140px;
    text-align: right;
}

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

.file-item:hover {
    background: hsl(var(--accent));
}

.file-item.folder {
    font-weight: 500;
    color: hsl(var(--foreground));
}

.file-item.file {
    color: hsl(var(--foreground));
}

.file-icon {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

.file-name {
    flex: 1;
    font-size: 0.875rem;
}

.file-size {
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
}

.breadcrumb {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem;
    background: hsl(var(--muted));
    border-radius: calc(var(--radius) - 2px);
}

.breadcrumb-item {
    color: hsl(var(--primary));
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.breadcrumb-item:hover {
    color: hsl(var(--primary) / 0.8);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

.loading,
.empty {
    text-align: center;
    padding: 2rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

/* Модальное окно для логов */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: hsl(var(--card));
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-width: 900px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: hsl(var(--muted-foreground));
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: hsl(var(--foreground));
}

.download-logs {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    background: hsl(var(--muted) / 0.3);
    max-height: calc(80vh - 80px);
}

.log-entry {
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: calc(var(--radius) - 4px);
    word-wrap: break-word;
}

.log-entry.info {
    color: hsl(221.2 83.2% 53.3%);
    background: hsl(221.2 83.2% 53.3% / 0.1);
}

.log-entry.output {
    color: hsl(var(--foreground));
    background: transparent;
}

.log-entry.success {
    color: hsl(142.1 70.6% 45.3%);
    background: hsl(142.1 76.2% 36.3% / 0.1);
    font-weight: 600;
}

.log-entry.error {
    color: hsl(0 72.2% 50.6%);
    background: hsl(0 84.2% 60.2% / 0.1);
    font-weight: 600;
}

.file-viewer {
    margin-top: 1rem;
    padding: 1rem;
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
    max-height: 400px;
    overflow: auto;
}

.file-viewer pre {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 0.8125rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: hsl(var(--foreground));
}

.file-viewer img {
    max-width: 100%;
    height: auto;
    border-radius: calc(var(--radius) - 2px);
}

.history-item {
    padding: 0.75rem;
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

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

.history-item:hover {
    background: hsl(var(--accent));
}

.history-info {
    flex: 1;
}

.history-uuid {
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.history-locale {
    color: hsl(var(--muted-foreground));
    font-size: 0.8125rem;
    margin-bottom: 0.125rem;
}

.history-date {
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

.history-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s;
}

.history-btn-use {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.history-btn-use:hover {
    background: hsl(var(--primary) / 0.9);
}

.setup-status {
    margin-top: 1.5rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: hsl(var(--muted));
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid hsl(var(--border));
}

.status-label {
    font-weight: 500;
    min-width: 120px;
    color: hsl(var(--foreground));
}

.status-value {
    flex: 1;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.status-value.success {
    color: hsl(142.1 70.6% 45.3%);
    font-weight: 500;
}

.status-value.error {
    color: hsl(0 72.2% 50.6%);
    font-weight: 500;
}

.setup-instructions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid hsl(var(--border));
}

.instructions-content {
    background: hsl(var(--muted));
    padding: 1rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    line-height: 1.6;
    color: hsl(var(--foreground));
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}
