/* The room's sign-in page: the card, the background, the buttons and the
   dialogs. Both the page and the panel preview load this one file. */
        /* One accent, flat surfaces, an 8px rhythm: the same card in every
           room, whatever the room's own background picture is. */
        :root { --cs-login-accent: #1f7ae0; }
        body {
            background: var(--cs-login-bg, #0f172a) no-repeat center center fixed;
            background-size: cover;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            margin: 0;
            padding: 20px;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            position: relative;
        }
        
        body::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.45);
            z-index: -1;
        }
        
        .login-container {
            background: #ffffff;
            border-radius: 12px;
            padding: 32px 28px;
            width: 100%;
            max-width: 400px;
            box-shadow: 0 24px 60px -24px rgba(2, 8, 20, 0.6);
            border: 1px solid rgba(15, 23, 42, 0.08);
            text-align: center;
        }
        
        .chatname {
            color: #0f172a;
            font-weight: 800;
            font-size: 24px;
            letter-spacing: -0.01em;
            margin-bottom: 4px;
        }
        
        .chattopic {
            color: #5b6b7d;
            font-size: 14px;
            margin-bottom: 24px;
        }
        
        .action-buttons {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 16px;
        }
        
        /* The owner's own markup sits in the same card; the layout inside is
           theirs, the card around it stays ours. */
        .cs-login-custom { display: flex; flex-direction: column; gap: 10px; text-align: inherit; }
        #csLoginCaptcha, .cs-login-captcha { display: flex; justify-content: center; margin-top: 4px; }
        
        .btn-action {
            width: 100%;
            min-height: 44px;
            padding: 10px 16px;
            border-radius: 8px;
            border: 1px solid transparent;
            font-weight: 600;
            font-size: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: background-color .15s ease, border-color .15s ease, color .15s ease;
            cursor: pointer;
        }
        .btn-action:focus-visible { outline: 2px solid var(--cs-login-accent); outline-offset: 2px; }

        /* Google's own button: white plate, Google mark, nothing else. */
        .btn-google {
            width: 100%;
            margin-top: 10px;
            background-color: #ffffff;
            color: #3c4043;
            border: 1px solid #dadce0;
            border-radius: 8px;
            letter-spacing: .1px;
        }

        .btn-google:hover {
            background-color: #f8f9fa;
            border-color: #c6c6c6;
        }

        .btn-google .cs-g { flex: 0 0 auto; }
        
        /* guest stays quiet, login is the one filled action, register sits
           beside it as an outline: one accent on the card, not three */
        .btn-guest {
            background-color: #ffffff;
            border-color: #d7dee8;
            color: #0f172a;
        }
        
        .btn-guest:hover {
            background-color: #f4f6fa;
            border-color: #c3cedd;
        }
        
        .btn-login {
            background-color: var(--cs-login-accent);
            border-color: var(--cs-login-accent);
            color: #ffffff;
        }
        
        .btn-login:hover {
            background-color: #1a68c2;
            border-color: #1a68c2;
        }
        
        .btn-register {
            background-color: #ffffff;
            border-color: color-mix(in srgb, var(--cs-login-accent) 45%, #d7dee8);
            color: var(--cs-login-accent);
        }
        
        .btn-register:hover {
            background-color: color-mix(in srgb, var(--cs-login-accent) 8%, #ffffff);
            border-color: var(--cs-login-accent);
        }
        
        /* a dialog owns the screen: the card behind it stops peeking out */
        body:has(.modal-overlay.active) .login-container { visibility: hidden; }
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(8, 13, 23, 0.6);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            padding: 16px;
            overflow-y: auto;
        }
        
        .modal-overlay.active {
            opacity: 1;
            visibility: visible;
        }
        
        .modal-content {
            background-color: white;
            width: 100%;
            max-width: 380px;
            margin: auto;
            max-height: calc(100dvh - 32px);
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            border-radius: 12px;
            box-shadow: 0 24px 60px -24px rgba(2, 8, 20, 0.6);
            transform: translateY(8px);
            opacity: 0;
            transition: opacity 0.18s ease, transform 0.18s ease;
        }
        
        .modal-overlay.active .modal-content {
            transform: translateY(0);
            opacity: 1;
        }
        
        .modal_header {
            background-color: #f8fafc;
            color: #0f172a;
            border-bottom: 1px solid #e5eaf0;
            border-radius: 12px 12px 0 0;
            padding: 14px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .modal-title {
            font-weight: 700;
            font-size: 17px;
        }
        
        .modal-close {
            background: none;
            border: none;
            color: #64748b;
            font-size: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            border-radius: 8px;
            padding: 0;
            transition: background-color .15s ease, color .15s ease;
        }
        
        .modal-close:hover {
            background-color: #eef2f7;
            color: #0f172a;
        }
        
        .modal-body {
            padding: 20px;
            position: relative;
        }
        
        .loading-ripple {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: white;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10;
        }
        
.ripple {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.ripple::before,
.ripple::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--cs-login-accent);
  animation: ripplePulse 1.2s ease-out infinite;
  opacity: 0;
}

.ripple::after {
  animation-delay: 0.6s; /* second smaller ripple */
}

@keyframes ripplePulse {
  0% {
    transform: scale(0.7);
    opacity: 0.9;
  }
  50% {
    transform: scale(1);
    opacity: 0.4;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}
        .form-container {
            opacity: 0;
            transform: translateY(10px);
            transition: all 0.4s ease 0.2s;
        }
        
        .form-container.loaded {
            opacity: 1;
            transform: translateY(0);
        }
        
        .form-group {
            margin-bottom: 16px;
            text-align: left;
        }
        
        .form-label {
            display: block;
            margin-bottom: 6px;
            font-weight: 500;
            color: #374151;
            font-size: 14px;
        }
        
        .form-control {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #d7dee8;
            border-radius: 8px;
            font-size: 15px;
            transition: border-color .15s ease, box-shadow .15s ease;
        }
        
        .form-control:focus {
            outline: none;
            border-color: var(--cs-login-accent);
            box-shadow: 0 0 0 3px color-mix(in srgb, var(--cs-login-accent) 18%, transparent);
        }
        
        .modal-content { text-align: left; }
        .btn-modal {
            width: 100%;
            padding: 11px 16px;
            color: white;
            background-color: var(--cs-login-accent);
            border-radius: 8px;
            border: none;
            font-weight: 600;
            font-size: 15px;
            cursor: pointer;
            transition: background-color .15s ease;
        }
        
        .btn-modal:hover {
            background-color: #1a68c2;
        }
        
        .btn-modal-primary {
            background-color: var(--cs-login-accent);
        }
        
        .btn-modal-primary:hover {
            background-color: #1a68c2;
        }
        
        .forgot-password {
            display: block;
            text-align: center;
            margin-top: 12px;
            color: #6b7280;
            font-size: 13px;
            text-decoration: none;
            transition: color 0.2s ease;
        }
        
        .forgot-password:hover {
            color: var(--cs-login-accent);
        }
        
        .footer {
            margin-top: 24px;
            color: rgba(255, 255, 255, 0.7);
            font-size: 13px;
            text-align: center;
        }
        
        .footer a {
            color: rgba(255, 255, 255, 0.9);
            text-decoration: none;
            transition: color 0.2s ease;
        }
        
        .footer a:hover {
            color: white;
        }
        
        .alert-danger {
            background-color: rgba(220, 53, 69, 0.1);
            color: #dc3545;
            padding: 8px 12px;
            border-radius: 5px;
            margin-bottom: 16px;
            border: 1px solid rgba(220, 53, 69, 0.2);
            font-size: 14px;
        }
        
        #smallModal {
            display: none;
        }
        
        #smallModal.active {
            display: flex;
            justify-content: center;
            align-items: center;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            z-index: 2000;
        }
        
        .profileWidth {
            background-color: white;
            border-radius: 8px;
            padding: 20px;
            max-width: 400px;
            width: 90%;
            text-align: center;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
        }
        
        .links {
            color: var(--cs-login-accent);
            text-decoration: none;
        }
        
        .links:hover {
            text-decoration: underline;
        }
        
        .guest-note {
            background-color: #f4f7fb;
            border-left: 3px solid var(--cs-login-accent);
            padding: 12px 14px;
            margin-bottom: 16px;
            border-radius: 4px;
            font-size: 13.5px;
            line-height: 1.5;
            text-align: left;
            color: #495057;
        }

        /* ---- styled <select> ---- */
        select.form-control{
            appearance:none;-webkit-appearance:none;
            background-color:#fff;
            background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' fill='none' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
            background-repeat:no-repeat;background-position:right 13px center;
            padding:10px 38px 10px 12px;border-radius:8px;font-weight:600;cursor:pointer;
        }
        select.form-control option{background:#fff;color:#111827;}
        select.form-control:focus{transform:none;}

        /* ---- login feedback banner ---- */
        .cs-login-error{
            display:flex;align-items:flex-start;gap:9px;text-align:left;
            background:#fdecec;border:1px solid #f5b5b5;color:#8c1d1d;
            border-radius:12px;padding:11px 14px;margin:0 auto 16px;max-width:430px;
            font-size:13.5px;font-weight:600;line-height:1.45;
            animation:csErrIn .18s ease-out;
        }
        .cs-login-error i,.cs-login-error svg{width:18px;height:18px;flex:0 0 auto;margin-top:1px;}
        .cs-login-error b{display:block;font-size:11px;text-transform:uppercase;letter-spacing:.06em;opacity:.75;}
        /* signed out by the room control panel: an explained state, not an error */
        .cs-login-note{
            display:flex;align-items:flex-start;gap:9px;text-align:left;
            background:#eef4ff;border:1px solid #b9cdf5;color:#1e3a6b;
            border-radius:12px;padding:11px 14px;margin:0 auto 16px;max-width:430px;
            font-size:13.5px;font-weight:600;line-height:1.45;
            animation:csErrIn .18s ease-out;
        }
        .cs-login-note i,.cs-login-note svg{width:18px;height:18px;flex:0 0 auto;margin-top:1px;}
        @keyframes csErrIn{from{opacity:0;transform:translateY(-6px);}to{opacity:1;transform:none;}}
        .modal-overlay .cs-login-error{margin:0 0 16px;max-width:none;}
        .cs-login-error-modal{animation:csErrIn .18s ease-out;}
        @media (max-width: 480px){
            .modal-overlay .cs-login-error{padding:10px 12px;font-size:13px;margin-bottom:14px;}
            .modal-overlay{padding:12px;}
            .modal-content{max-width:100%;border-radius:16px;max-height:calc(100dvh - 24px);}
            .modal-body{padding:16px;}
            .modal_header{padding:12px 16px;}
            .modal-title{font-size:16px;}
            .form-control{font-size:16px;}
            .login-container{padding:20px 16px;}
            .chatname{font-size:22px;}
        }
