/* ============================================
   COMPONENTS.CSS — Кнопки, инпуты, карточки, модалки
   ============================================ */

/* --- Кнопки --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
}

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

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

/* Primary (зеленая) */
.btn-primary {
    background: transparent;
    color: var(--accent-green);
    border: 2px solid var(--accent-green);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-green);
    color: var(--bg-primary);
    box-shadow: var(--glow-green);
}

/* Secondary (серая) */
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: #3a3a3a;
    border-color: #5a5a5a;
}

/* Danger (красная) */
.btn-danger {
    background: transparent;
    color: var(--accent-red);
    border: 2px solid var(--accent-red);
}

.btn-danger:hover:not(:disabled) {
    background: var(--accent-red);
    color: var(--bg-primary);
}

/* Размеры */
.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

/* --- Инпуты --- */
.input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: all var(--transition-normal);
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px var(--accent-green-glow);
}

.input--mono {
    font-family: var(--font-mono);
}

.input--error {
    border-color: var(--accent-red);
}

.input--error:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-dim);
}

.input--lg {
    padding: 18px 24px;
    font-size: 1.25rem;
}

/* --- Сообщения об ошибках в формах --- */
.auth-form__error {
    font-size: 0.8rem;
    color: var(--accent-red);
    margin-top: 6px;
    display: none;
}

/* --- Карточки --- */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: #5a5a5a;
    box-shadow: var(--shadow-md);
}

.card--hover {
    cursor: pointer;
}

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

/* --- Бейджи --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.badge--success {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

.badge--warning {
    background: var(--accent-yellow-dim);
    color: var(--accent-yellow);
}

.badge--danger {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

.badge--sm {
    padding: 3px 8px;
    font-size: 0.75rem;
}

/* --- Flash сообщения --- */
.flash {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.flash--success {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.flash--error {
    background: rgba(209, 105, 105, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.flash--info {
    background: rgba(100, 149, 237, 0.1);
    border: 1px solid #6495ED;
    color: #6495ED;
}

/* --- Skeleton Loading --- */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        #3a3a3a 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton--text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton--title {
    height: 24px;
    margin-bottom: 12px;
}

.skeleton--image {
    height: 300px;
    width: 100%;
}

/* --- Терминальный курсор --- */
.cursor-blink::after {
    content: '_';
    animation: blink 1s step-end infinite;
    color: var(--accent-green);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* --- Accuracy Bar --- */
.accuracy-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.accuracy-bar__fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease, background 0.3s ease;
}

.accuracy-bar__fill--high {
    background: var(--accent-green);
}

.accuracy-bar__fill--medium {
    background: var(--accent-yellow);
}

.accuracy-bar__fill--low {
    background: var(--accent-red);
}

/* --- Прогресс бар --- */
.progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: var(--accent-green);
    transition: width 0.5s ease;
}

/* --- Модальные окна --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal--visible {
    opacity: 1;
    visibility: visible;
}

.modal__content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal--visible .modal__content {
    transform: scale(1);
}

.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal__title {
    font-size: 1.5rem;
    font-weight: 700;
}

.modal__close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal__close:hover {
    color: var(--text-primary);
}

/* --- Таблицы --- */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color-light);
}

.table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    color: var(--text-primary);
}

.table tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* --- Тултипы --- */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    pointer-events: none;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}
