/* ============================================================
   NextChat — Sistema de Design SAP Fiori (Modern)
   ============================================================ */

:root {
    /* Cores principais SAP Fiori */
    --sap-brand: #0070f2;
    --sap-brand-hover: #0062d1;
    --sap-brand-active: #0057bd;
    --sap-bg: #f5f6f7;
    --sap-bg-secondary: #eaecee;
    --sap-surface: #ffffff;
    --sap-text: #32363a;
    --sap-text-inverse: #ffffff;
    --sap-text-muted: #6a6d70;
    --sap-border: #d9dce0;
    --sap-border-strong: #c0c6cc;
    --sap-success: #107e3e;
    --sap-warning: #e9730c;
    --sap-error: #d20a0a;
    --sap-accent: #cc1919; /* mIRC vermelho */
    --sap-info: #0854a0;

    /* Roles mIRC */
    --role-admin: #cc1919;
    --role-operator: #0854a0;

    /* Tipografia SAP "72" (fallback Segoe UI) */
    --sap-font: '72', '72full', 'Segoe UI', 'Arial', sans-serif;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.18);

    /* Layout */
    --shell-height: 52px;
    --radius: 4px;
    --radius-lg: 8px;
}

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

html, body {
    height: 100%;
}

body {
    font-family: var(--sap-font);
    font-size: 14px;
    color: var(--sap-text);
    background: var(--sap-bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--sap-brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================================
   SHELL BAR (barra superior estilo SAP Fiori)
   ============================================================ */
.sap-shell {
    height: var(--shell-height);
    background: var(--sap-brand);
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: var(--shadow-sm);
    color: var(--sap-text-inverse);
    position: relative;
    z-index: 10;
}

.sap-shell .shell-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-right: 24px;
}

.sap-shell .shell-logo .logo-mark {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    color: var(--sap-text-inverse);
}

.sap-shell .shell-title {
    font-size: 14px;
    opacity: 0.95;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sap-shell .shell-spacer {
    flex: 1;
}

.sap-shell .shell-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}

.sap-shell .shell-user:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sap-shell .shell-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
}

/* ============================================================
   BOTÕES SAP Fiori
   ============================================================ */
.sap-btn {
    font-family: var(--sap-font);
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    padding: 8px 20px;
    height: 36px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
    white-space: nowrap;
}

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

.sap-btn--primary {
    background: var(--sap-brand);
    color: var(--sap-text-inverse);
}

.sap-btn--primary:hover:not(:disabled) {
    background: var(--sap-brand-hover);
}

.sap-btn--primary:active:not(:disabled) {
    background: var(--sap-brand-active);
}

.sap-btn--secondary {
    background: var(--sap-surface);
    color: var(--sap-brand);
    border: 1px solid var(--sap-brand);
}

.sap-btn--secondary:hover:not(:disabled) {
    background: #eaf4ff;
}

.sap-btn--danger {
    background: var(--sap-surface);
    color: var(--sap-error);
    border: 1px solid var(--sap-error);
}

.sap-btn--danger:hover:not(:disabled) {
    background: #fdecec;
}

.sap-btn--ghost {
    background: transparent;
    color: var(--sap-brand);
}

.sap-btn--ghost:hover:not(:disabled) {
    background: #eaf4ff;
}

.sap-btn--icon {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
}

.sap-btn--block {
    width: 100%;
}

/* ============================================================
   INPUTS SAP Fiori
   ============================================================ */
.sap-field {
    margin-bottom: 16px;
}

.sap-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--sap-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.sap-input, .sap-textarea, .sap-select {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    font-family: var(--sap-font);
    font-size: 14px;
    color: var(--sap-text);
    background: var(--sap-surface);
    border: 1px solid var(--sap-border-strong);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.sap-textarea {
    height: auto;
    min-height: 45px;
    padding: 8px 10px;
    resize: vertical;
}

.sap-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236a6d70' d='M6 8.5L1.5 4l1.1-1.1L6 6.3l3.4-3.4L10.5 4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.sap-input:focus, .sap-textarea:focus, .sap-select:focus {
    border-color: var(--sap-brand);
    box-shadow: 0 0 0 1px var(--sap-brand);
}

.sap-input--invalid {
    border-color: var(--sap-error);
}

.sap-hint {
    font-size: 12px;
    color: var(--sap-error);
    margin-top: 4px;
    display: none;
}

.sap-field--invalid .sap-hint {
    display: block;
}

.sap-field--invalid .sap-input,
.sap-field--invalid .sap-textarea,
.sap-field--invalid .sap-select {
    border-color: var(--sap-error);
}

/* ============================================================
   CARDS
   ============================================================ */
.sap-card {
    background: var(--sap-surface);
    border: 1px solid var(--sap-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s;
    overflow: hidden;
}

.sap-card--hoverable:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.sap-card__header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--sap-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sap-card__title {
    font-size: 16px;
    font-weight: 600;
}

.sap-card__body {
    padding: 16px;
}

/* ============================================================
   PANEL (tela central de login/cadastro)
   ============================================================ */
.sap-panel-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eaf4ff 0%, #f5f6f7 50%, #eaf4ff 100%);
    padding: 24px;
}

.sap-panel {
    width: 100%;
    max-width: 420px;
    background: var(--sap-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.sap-panel__head {
    background: var(--sap-brand);
    padding: 28px 24px;
    color: var(--sap-text-inverse);
}

.sap-panel__head .brand {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.sap-panel__head .subtitle {
    font-size: 13px;
    opacity: 0.9;
}

.sap-panel__body {
    padding: 24px;
}

.tab-bar {
    display: flex;
    border-bottom: 2px solid var(--sap-border);
    margin-bottom: 24px;
}

.tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--sap-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    font-family: var(--sap-font);
}

.tab--active {
    color: var(--sap-brand);
    border-bottom-color: var(--sap-brand);
}

/* ============================================================
   TOASTS / NOTIFICAÇÕES
   ============================================================ */
.sap-toast {
    position: fixed;
    top: 68px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}

.sap-toast__item {
    background: var(--sap-surface);
    border-left: 4px solid var(--sap-brand);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slide-in 0.2s ease;
}

.sap-toast__item--success { border-left-color: var(--sap-success); }
.sap-toast__item--error { border-left-color: var(--sap-error); }
.sap-toast__item--warning { border-left-color: var(--sap-warning); }

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

/* ============================================================
   GRILLAS / UTILITÁRIOS
   ============================================================ */
.sap-grid {
    display: grid;
    gap: 16px;
}

.sap-grid--rooms {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

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

.sap-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--sap-bg-secondary);
    color: var(--sap-text);
}

.sap-badge--public { background: #eaf4ff; color: var(--sap-info); }
.sap-badge--private { background: #fdecec; color: var(--sap-error); }
