/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4 {
    line-height: 1.2;
    font-weight: 700;
    color: var(--gray-900);
}

h1 { font-size: 2.75rem; letter-spacing: -0.03em; }
h2 { font-size: 2rem; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; }

ul { list-style: none; }

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-sm { max-width: 800px; }
.container-xs { max-width: 480px; }

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Section title */
.section-title {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: var(--shadow), 0 0 0 0 rgba(99, 102, 241, 0);
}
.btn-primary:hover {
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--gray-50);
    color: var(--text);
    border-color: var(--gray-300);
}

.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; }

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

/* Badge Pro */
.badge-pro {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    border-radius: var(--radius-full);
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.site-header > .container {
    display: flex;
    align-items: center;
    height: 64px;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}
.logo:hover { color: var(--text); }
.logo strong { color: var(--primary); }

.nav-desktop {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

.nav-link {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.nav-link:hover {
    color: var(--text);
    background: var(--gray-50);
}

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

/* Burger */
.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}
.burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all var(--transition);
}

.nav-mobile {
    display: none;
    flex-direction: column;
    padding: 1rem 1.5rem 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.nav-mobile a {
    padding: 0.75rem 0;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--gray-100);
}
.nav-mobile a:hover { color: var(--primary); }
.nav-mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

body.menu-open .nav-mobile { display: flex; }
body.menu-open .burger span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
body.menu-open .burger span:nth-child(2) { opacity: 0; }
body.menu-open .burger span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Footer */
.site-footer {
    background: var(--bg-dark);
    color: var(--gray-400);
    padding: var(--space-4xl) 0 var(--space-xl);
    margin-top: var(--space-4xl);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand .logo {
    margin-bottom: 1rem;
    color: white;
}
.footer-brand p {
    font-size: 0.875rem;
    line-height: 1.7;
    max-width: 300px;
}

.footer-links h4 {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.footer-links a {
    display: block;
    padding: 0.3rem 0;
    font-size: 0.875rem;
    color: var(--gray-400);
    transition: color var(--transition);
}
.footer-links a:hover { color: white; }

.footer-bottom {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-800);
    text-align: center;
    font-size: 0.8125rem;
}

/* Flash messages */
.flash-container {
    position: fixed;
    top: 80px;
    right: 1.5rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}

.flash {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    animation: flashIn 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.flash-success { background: var(--success-light); color: #065f46; }
.flash-error { background: var(--error-light); color: #991b1b; }
.flash-info { background: var(--info-light); color: #164e63; }
.flash-warning { background: var(--warning-light); color: #92400e; }

.flash-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    color: inherit;
}

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

/* Legal pages */
.legal-page {
    padding: var(--space-4xl) 0;
}
.legal-page h1 {
    margin-bottom: var(--space-xl);
}
.legal-page h2 {
    font-size: 1.375rem;
    margin: var(--space-xl) 0 var(--space-md);
}
.legal-page p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    line-height: 1.8;
}

/* Error page */
.error-page {
    padding: var(--space-4xl) 0;
    text-align: center;
    min-height: 60vh;
    display: flex;
    align-items: center;
}
.error-content h1 {
    font-size: 8rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin-bottom: 1rem;
}
.error-content p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

/* Form */
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--gray-700);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font);
    font-size: 0.9375rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    transition: all var(--transition);
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}
.form-group input::placeholder {
    color: var(--text-muted);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
}
th {
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}
td {
    border-bottom: 1px solid var(--gray-100);
}
tbody tr:hover { background: var(--gray-50); }

.format-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: var(--radius-sm);
    letter-spacing: 0.03em;
}

.td-filename {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.td-reduction {
    color: var(--success);
    font-weight: 600;
}
