:root {
    --brand-primary: #5e6ad2;
    --brand-secondary: #9c27b0;
    --brand-accent: #00f2fe;
    --bg-dark: #0a0b0d;
    --bg-card: #131416;
    --bg-card-hover: #191b1e;
    --bg-modal: #12141a;
    --bg-input: rgba(255, 255, 255, 0.04);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --vk-color: #0077ff;
    --telegram-color: #24a1de;
    
    --text-primary: #ffffff;
    --text-muted: #94a3b8;
    --text-hint: #64748b;
    
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

button, input {
    font-family: inherit;
}

html, body {
    width: 100%;
    min-height: 100vh;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.main-header {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 11, 13, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.logo {
    font-size: 1.35rem;
    font-weight: 850;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--brand-accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.btn-primary {
    background: var(--brand-primary);
    border: none;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 10px 20px;
    border-radius: 8px;
    transition: background var(--transition), transform var(--transition);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary:hover {
    background: #4f5cd1;
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    transition: all var(--transition);
}

.btn-secondary:hover {
    color: #fff;
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.05);
}

/* App Layout Grid */
.app-layout {
    flex: 1;
    display: flex;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 30px 24px;
    gap: 30px;
}

/* Sidebar */
.app-sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.nav-item:hover, .nav-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
}

.nav-item.active {
    color: var(--brand-accent);
    background: rgba(0, 240, 255, 0.06);
    border-color: rgba(0, 240, 255, 0.2);
}

.nav-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Main Dashboard Area */
.app-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.prompt-bar-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.prompt-title {
    font-size: 1.2rem;
    font-weight: 800;
}

.prompt-input-wrapper {
    display: flex;
    gap: 12px;
}

.prompt-input {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
}

.prompt-input:focus {
    border-color: var(--brand-primary);
}

/* AI Models Grid */
.models-grid-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 14px;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.model-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 160px;
}

.model-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    background: var(--bg-card-hover);
}

.model-name {
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.model-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.model-tag {
    align-self: flex-start;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand-accent);
    background: rgba(0, 240, 255, 0.08);
    padding: 3px 10px;
    border-radius: 12px;
}

/* Modal Window */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 6, 8, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.auth-modal {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 38px 32px 30px 32px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 24px;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.modal-close-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

.modal-header {
    text-align: center;
    margin-bottom: 28px;
}

.modal-title {
    font-size: 1.95rem;
    font-weight: 800;
    letter-spacing: -0.6px;
    margin-bottom: 8px;
    color: #ffffff;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* Social Buttons */
.social-auth {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 13px 20px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.btn-social:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.social-icon-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vk-badge { background: var(--vk-color); }
.tg-badge { background: var(--telegram-color); }

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-hint);
    font-size: 0.8rem;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}

.divider span {
    padding: 0 14px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.84rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.input-field {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #fff;
    font-size: 0.96rem;
    outline: none;
    transition: var(--transition);
}

.input-field:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

.btn-primary-action {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 50px;
    background: var(--brand-primary);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.98rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(94, 106, 210, 0.35);
    margin-top: 4px;
}

.btn-primary-action:hover:not(:disabled) {
    background: #4f5cd1;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(94, 106, 210, 0.5);
}

.btn-primary-action:disabled {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.step-hidden {
    display: none;
}

.otp-info {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.4;
}

.otp-info strong {
    color: #fff;
}

.link-btn {
    background: none;
    border: none;
    color: var(--brand-accent);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 6px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.link-btn:disabled {
    color: var(--text-hint);
    text-decoration: none;
    cursor: not-allowed;
}

.otp-input-group {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.otp-digit {
    width: 48px;
    height: 52px;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: #fff;
    outline: none;
    transition: var(--transition);
}

.otp-digit:focus {
    border-color: var(--brand-primary);
    background: rgba(255, 255, 255, 0.08);
}

.resend-container {
    margin-top: 16px;
    text-align: center;
}

.modal-legal {
    margin-top: 26px;
    font-size: 0.78rem;
    color: var(--text-hint);
    text-align: center;
    line-height: 1.45;
}

.modal-legal a {
    color: var(--text-muted);
    text-decoration: underline;
}

.app-footer {
    padding: 24px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-hint);
    border-top: 1px solid var(--border-color);
}

.app-footer a {
    color: var(--text-muted);
    text-decoration: none;
}
