/* Reset и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #475569;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 90%;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav {
    display: flex;
    gap: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.main {
    flex: 1;
    padding: 2rem;
    max-width: 95%;
    margin: 0 auto;
    width: 100%;
}

/* Pages */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

/* Hero Section */
.hero {
    text-align: center;
    max-width: 600px;
    margin: 4rem auto 6rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.feature {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.feature:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--text-secondary);
}

/* Forms */
.form-container {
    max-width: 90%;
    margin: 2rem auto;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Расширенный контейнер для просмотра заметок */
.form-container.wide {
    max-width: 98%;
    width: 100%;
}

.form-header {
    padding: 2rem 2rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
}

.form-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.form-header p {
    color: var(--text-secondary);
}

.form {
    padding: 2rem;
}

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

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--surface);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

/* Placeholder стили для темной темы */
.form-control::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.8;
}

.form-control::-webkit-input-placeholder {
    color: var(--text-muted) !important;
    opacity: 0.8;
}

.form-control::-moz-placeholder {
    color: var(--text-muted) !important;
    opacity: 0.8;
}

.form-control:-ms-input-placeholder {
    color: var(--text-muted) !important;
    opacity: 0.8;
}

/* Дополнительно для textarea */
textarea::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.8;
}

/* Принудительно устанавливаем цвет текста для всех элементов ввода */
input, textarea, select {
    color: var(--text-primary) !important;
    background: var(--surface) !important;
}

input[type="text"], 
input[type="password"], 
textarea, 
select {
    color: var(--text-primary) !important;
    background: var(--surface) !important;
    border: 2px solid var(--border) !important;
}

/* Убираем стили браузера по умолчанию и принудительно устанавливаем наши */
textarea#paste-content,
input#paste-password,
input#view-password,
select#language-selector {
    color: var(--text-primary) !important;
    background: var(--surface) !important;
    border: 2px solid var(--border) !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Принудительно переопределяем user-agent стили */
textarea {
    color: var(--text-primary) !important;
    background-color: var(--surface) !important;
}

/* Выделение текста */
::selection {
    background: var(--primary-color);
    color: white;
}

::-moz-selection {
    background: var(--primary-color);
    color: white;
}

/* Scrollbar стили для темной темы */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.textarea {
    resize: vertical;
    min-height: 200px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    line-height: 1.5;
}

.char-counter {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Success page */
.success-container {
    max-width: 600px;
    margin: 2rem auto;
    text-align: center;
    background: var(--surface);
    padding: 3rem 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.success-icon {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.success-container h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.success-container p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.125rem;
}

.link-container {
    margin: 2rem 0;
    text-align: left;
}

.link-input-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.link-input-group .form-control {
    flex: 1;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.875rem;
}

.success-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Paste display */
.paste-display {
    margin-top: 2rem;
    animation: fadeIn 0.3s ease;
    padding: 0 1rem;
}

.paste-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--surface-hover);
    border-radius: var(--radius) var(--radius) 0 0;
}

.paste-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.paste-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.language-selector {
    min-width: 150px;
    padding: 0.5rem;
    font-size: 0.875rem;
}

.paste-content {
    background: #0f172a !important;
    border: 1px solid var(--border);
    border-radius: var(--radius) !important;
    padding: 0 !important;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 70vh;
    overflow: auto;
    margin: 0 !important;
}

.paste-content code {
    background: transparent !important;
    padding: 2rem !important;
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary) !important;
}

/* Prism.js кастомизация для темной темы */
pre[class*="language-"] {
    margin: 0;
    padding: 0;
    background: #0f172a !important;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

pre[class*="language-"].line-numbers {
    padding-left: 4.5em;
}

.line-numbers .line-numbers-rows {
    border-right: 1px solid var(--border);
    background: #1e293b;
}

.line-numbers-rows > span:before {
    color: var(--text-muted);
}

/* Переопределяем цвета токенов Prism.js для темной темы */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #64748b !important;
}

.token.punctuation {
    color: #cbd5e1 !important;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: #fbbf24 !important;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #34d399 !important;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #f87171 !important;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #a78bfa !important;
}

.token.function,
.token.class-name {
    color: #60a5fa !important;
}

.token.regex,
.token.important,
.token.variable {
    color: #fb7185 !important;
}

/* Темная тема для кода */
@media (prefers-color-scheme: dark) {
    .paste-content {
        background: #0f172a !important;
        border-color: var(--border);
    }
    
    pre[class*="language-"] {
        background: #0f172a !important;
    }
    
    .line-numbers .line-numbers-rows {
        background: #1e293b;
        border-right-color: var(--border);
    }
}

.paste-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #451a03;
    color: #fbbf24;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin: 1rem 1.5rem;
    font-size: 0.875rem;
    border: 1px solid #78350f;
}

/* Notifications */
.notifications {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

.notification.success {
    background: var(--success-color);
}

.notification.error {
    background: var(--error-color);
}

.notification.warning {
    background: var(--warning-color);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    font-size: 2rem;
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 95%) {
    .main {
        padding: 1rem;
    }
    
    .header-content {
        padding: 1rem;
    }
    
    .hero {
        margin: 2rem auto 3rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .form-container {
        margin: 1rem auto;
        border-radius: var(--radius-lg);
    }
    
    .form-container.wide {
        max-width: 99%;
        margin: 0.25rem auto;
    }
    
    .form {
        padding: 1.5rem;
    }
    
    .form-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .success-container {
        margin: 1rem auto;
        padding: 2rem 1.5rem;
        border-radius: var(--radius-lg);
    }
    
    .form-actions,
    .success-actions {
        flex-direction: column;
    }
    
    .link-input-group {
        flex-direction: column;
    }
    
    .notifications {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .notification {
        min-width: auto;
    }
    
    .features {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feature {
        padding: 1.5rem;
    }
    
    .paste-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .paste-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .language-selector {
        flex: 1;
    }
}
