:root {
    --bg-color: #080c14;
    --card-bg: rgba(13, 20, 35, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent-color: #6366f1;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --success-color: #10b981;
    --error-color: #ef4444;
    --success-glow: rgba(16, 185, 129, 0.2);
    --accent-glow: rgba(99, 102, 241, 0.25);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Фоновый интерактивный арт с градиентами */
.glow-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
    animation: float 15s ease-in-out infinite alternate;
}

.sphere-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, rgba(0,0,0,0) 70%);
    top: -10%;
    left: 5%;
}

.sphere-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.25) 0%, rgba(0,0,0,0) 70%);
    bottom: -10%;
    right: 5%;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(40px) scale(1.1); }
}

/* Общие контейнеры */
.container {
    position: relative;
    z-index: 10;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

body.logged-in {
    align-items: flex-start;
}

body.logged-in .container {
    align-items: flex-start;
    padding-top: 40px;
    padding-bottom: 40px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

/* === ЭКРАН АВТОРИЗАЦИИ === */
.login-card {
    width: 100%;
    max-width: 440px;
    padding: 50px 40px;
    text-align: center;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.brand-logo {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 70px;
    height: 70px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 18px;
    margin-bottom: 24px;
    position: relative;
}

.brand-logo::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 22px;
    background: var(--accent-gradient);
    z-index: -1;
    opacity: 0.25;
    filter: blur(8px);
}

.brand-logo svg {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: url(#logo-grad);
    stroke-width: 2.2;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 35px;
    font-weight: 300;
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    padding-left: 4px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 2;
    pointer-events: none;
    transition: stroke 0.3s ease;
}

.form-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    padding: 14px 16px 14px 46px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.form-input:focus + .input-icon {
    stroke: var(--accent-color);
}

.btn-login {
    width: 100%;
    background: var(--accent-gradient);
    border: none;
    padding: 15px;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-login:active {
    transform: translateY(0);
}

.error-message {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--error-color);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-top: 20px;
    text-align: left;
    animation: fadeIn 0.3s ease;
}

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

/* === ЭКРАН ДАШБОРДА === */
.dashboard-view {
    display: none;
    width: 100%;
    max-width: 1000px;
    animation: fadeIn 0.6s ease forwards;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Боковая панель */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-card {
    padding: 30px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar-container {
    width: 80px;
    height: 80px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.avatar-container svg {
    width: 44px;
    height: 44px;
    fill: none;
    stroke: white;
    stroke-width: 2;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
    font-family: 'Outfit', sans-serif;
}

.profile-role {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.15);
    padding: 3px 10px;
    border-radius: 30px;
    color: #a5b4fc;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    padding: 4px 12px;
    border-radius: 50px;
    color: var(--success-color);
    margin-top: 8px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--success-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success-color);
    position: relative;
}

.status-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1px solid var(--success-color);
    animation: pulse-dot 2s infinite;
}

/* Меню навигации */
.nav-menu {
    padding: 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 8px;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: white;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.nav-item.disabled {
    pointer-events: none;
    opacity: 0.35;
    filter: grayscale(100%);
    cursor: not-allowed;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.nav-item-logout {
    color: var(--error-color) !important;
    margin-top: 20px;
}

.nav-item-logout:hover {
    background: rgba(239, 68, 68, 0.08) !important;
}

/* Главная контентная область */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.content-card {
    padding: 30px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 16px;
}

.content-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Сетка статусов сервисов */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.service-status-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.service-status-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.service-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.service-name {
    font-size: 0.95rem;
    font-weight: 600;
}

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

.service-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.80rem;
    font-weight: 600;
    color: var(--success-color);
}

.service-indicator-dot {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--success-color);
}

/* Интерактивная веб-консоль */
.terminal-container {
    background: #05080f;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.terminal-header {
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red { background-color: #ff5f56; }
.dot-yellow { background-color: #ffbd2e; }
.dot-green { background-color: #27c93f; }

.terminal-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    letter-spacing: 0.05em;
}

.terminal-body {
    padding: 20px;
    height: 240px;
    overflow-y: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #38bdf8;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.terminal-line {
    line-height: 1.5;
    word-break: break-all;
}

.terminal-output {
    color: #a7f3d0;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    color: #f472b6;
}

.terminal-prompt {
    margin-right: 8px;
    white-space: nowrap;
}

.terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: #e0f2fe;
    font-family: inherit;
    font-size: inherit;
    width: 100%;
}

/* Быстрые ссылки */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.link-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.link-button:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.link-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Стили для спецификации API */
.api-endpoint {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    text-align: left;
}

.api-endpoint:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.api-endpoint-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.api-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-post {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-get {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.api-path {
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: #e0f2fe;
}

.api-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 14px;
}

.api-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.api-schema {
    background: #04070d;
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 14px 16px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #38bdf8;
    overflow-x: auto;
    white-space: pre-wrap;
    margin-bottom: 14px;
}

.api-schema:last-child {
    margin-bottom: 0;
}

.badge-put {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Коллапсируемые методы API */
.api-endpoint-header {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 35px;
    margin-bottom: 0;
    transition: margin 0.25s ease;
}

.api-endpoint.expanded .api-endpoint-header {
    margin-bottom: 16px;
}

.api-endpoint-header::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-50%) rotate(45deg);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
}

.api-endpoint:hover .api-endpoint-header::after {
    border-color: var(--text-secondary);
}

.api-endpoint.expanded .api-endpoint-header::after {
    transform: translateY(-25%) rotate(-135deg);
    border-color: var(--text-primary);
}

.api-endpoint-details {
    display: none;
    animation: slideDownFade 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.api-endpoint.expanded .api-endpoint-details {
    display: block;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.badge-delete {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
