/* ═══════════════════════════════════════════════════════════
   CRM «Global Mining» — стили авторизации
   auth.css подключается в <head> crm.html
═══════════════════════════════════════════════════════════ */

/* ── ЭКРАНЫ ВХОДА / ПЕРВОГО ЗАПУСКА ───────────────────── */

.auth-ov {
    position: fixed;
    inset: 0;
    background: linear-gradient(145deg, #0d1117 0%, #1a1a2e 55%, #0e2850 100%);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-box {
    background: #fff;
    border-radius: 22px;
    padding: 44px 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 72px rgba(0,0,0,0.55);
    text-align: center;
}

.auth-logo-img {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    margin-bottom: 14px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.auth-title {
    font-size: 21px;
    font-weight: 800;
    color: #1A1A2E;
    margin: 0 0 5px;
    letter-spacing: 0.2px;
}

.auth-subtitle {
    font-size: 13px;
    color: #888;
    margin: 0 0 28px;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 1.5px solid #C5D0E6;
    border-radius: 10px;
    margin-bottom: 12px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.18s, box-shadow 0.18s;
    color: #1A1A2E;
}

.auth-input:focus {
    border-color: #2E5FA3;
    box-shadow: 0 0 0 3px rgba(46,95,163,0.12);
}

.auth-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #1B3A6B 0%, #2E5FA3 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    font-family: inherit;
    letter-spacing: 0.3px;
    transition: opacity 0.15s, transform 0.1s;
}

.auth-btn:hover  { opacity: 0.92; transform: translateY(-1px); }
.auth-btn:active { transform: translateY(0); }
.auth-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.auth-err {
    margin-top: 12px;
    color: #B22222;
    font-size: 13px;
    min-height: 18px;
    font-weight: 500;
}

/* ── ЗНАЧОК ПОЛЬЗОВАТЕЛЯ В ШАПКЕ ─────────────────────── */

#auth-user-badge {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 22px;
    padding: 5px 12px 5px 8px;
    flex-shrink: 0;
    cursor: default;
}

#auth-user-badge img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.auth-badge-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.25;
}

.auth-badge-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.auth-badge-role {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
}

/* Кнопки в шапке (Журнал, Пользователи, Выйти) */
.auth-hdr-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.22);
    color: #fff;
    border-radius: 16px;
    padding: 5px 13px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s;
}

.auth-hdr-btn:hover { background: rgba(255,255,255,0.2); }

.auth-hdr-btn.auth-btn-logout {
    background: rgba(178,34,34,0.35);
    border-color: rgba(178,34,34,0.55);
}

.auth-hdr-btn.auth-btn-logout:hover { background: rgba(178,34,34,0.58); }

/* ── МОДАЛИ (ПОЛЬЗОВАТЕЛИ / ЖУРНАЛ) ──────────────────── */

.auth-modal-wrap {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9998;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px 60px;
    overflow-y: auto;
}

.auth-modal {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 860px;
    box-shadow: 0 16px 56px rgba(0,0,0,0.32);
}

.auth-modal-hdr {
    background: linear-gradient(135deg, #1B3A6B, #2E5FA3);
    color: #fff;
    padding: 18px 24px;
    border-radius: 18px 18px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1;
}

.auth-modal-hdr h2 {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
}

.auth-modal-close {
    background: rgba(255,255,255,0.18);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.auth-modal-close:hover { background: rgba(255,255,255,0.32); }

.auth-modal-body { padding: 20px 24px 28px; }

/* Кнопка «Добавить пользователя» */
.auth-add-btn {
    background: #1E7E34;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 16px;
    transition: opacity 0.15s;
}

.auth-add-btn:hover { opacity: 0.88; }

/* Форма создания / редактирования пользователя */
#auth-user-form {
    background: #EFF4FF;
    border: 1.5px solid #C5D0E6;
    border-radius: 12px;
    padding: 18px 20px 16px;
    margin-top: 16px;
    display: none;
}

#auth-user-form h3 {
    font-size: 14px;
    font-weight: 700;
    color: #1B3A6B;
    margin: 0 0 14px;
}

#auth-user-form input,
#auth-user-form select {
    width: 100%;
    padding: 9px 13px;
    font-size: 13px;
    border: 1.5px solid #C5D0E6;
    border-radius: 8px;
    margin-bottom: 10px;
    font-family: inherit;
    box-sizing: border-box;
    color: #1A1A2E;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}

#auth-user-form input:focus,
#auth-user-form select:focus { border-color: #2E5FA3; }

#auth-user-form input:disabled {
    background: #F0F4FF;
    color: #888;
    cursor: not-allowed;
}

/* Сетка прав */
.auth-perm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 12px 0 16px;
}

@media (max-width: 600px) {
    .auth-perm-grid { grid-template-columns: 1fr; }
}

.auth-perm-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    color: #1A1A2E;
    background: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1.5px solid #C5D0E6;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s;
}

.auth-perm-item:hover { border-color: #2E5FA3; background: #F0F4FF; }

.auth-perm-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #2E5FA3;
    cursor: pointer;
    flex-shrink: 0;
}

/* Кнопки формы */
.auth-form-btns { display: flex; gap: 10px; margin-top: 4px; }

.auth-save-btn {
    background: #1E7E34;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 22px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}

.auth-save-btn:hover { opacity: 0.88; }

.auth-cancel-btn {
    background: #fff;
    color: #666;
    border: 1.5px solid #C5D0E6;
    border-radius: 8px;
    padding: 9px 20px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.auth-cancel-btn:hover { background: #F7F9FD; }

.auth-form-err {
    color: #B22222;
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
    font-weight: 500;
}

/* ── ТАБЛИЦА ЖУРНАЛА ──────────────────────────────────── */

#auth-log-table { width: 100%; border-collapse: collapse; }

#auth-log-table th {
    background: #1B3A6B;
    color: #fff;
    padding: 9px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
}

.auth-log-pager {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0 0;
    font-size: 13px;
    color: #666;
    flex-wrap: wrap;
}

.auth-log-pager button {
    background: #2E5FA3;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}

.auth-log-pager button:hover:not(:disabled) { opacity: 0.84; }

.auth-log-pager button:disabled {
    background: #C5D0E6;
    cursor: not-allowed;
}
