/* ============================================================
   SimpleSAMLphp IdP Discovery Page – Stylesheet
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Helvetica, Arial, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* ── Screen-reader-only utility ──────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Wrapper card ─────────────────────────────────────────── */
.disco-wrapper {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
    width: 100%;
    max-width: 560px;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Header ───────────────────────────────────────────────── */
.disco-header {
    text-align: center;
}

.disco-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.02em;
}

.disco-subtitle {
    margin-top: 0.35rem;
    font-size: 0.95rem;
    color: #6b7280;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: #fef9c3;
    color: #713f12;
    border: 1px solid #fde68a;
}

/* ── Search box ───────────────────────────────────────────── */
.search-box {
    position: relative;
}

.search-box input[type="search"] {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #1a1a2e;
    background: #f9fafb;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    /* Remove native clear button in WebKit */
    -webkit-appearance: none;
}

.search-box input[type="search"]:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    background: #ffffff;
}

/* ── IdP list ─────────────────────────────────────────────── */
.idp-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px; /* room for scrollbar */
}

/* Custom scrollbar */
.idp-list::-webkit-scrollbar          { width: 6px; }
.idp-list::-webkit-scrollbar-track    { background: transparent; }
.idp-list::-webkit-scrollbar-thumb    { background: #d1d5db; border-radius: 3px; }
.idp-list::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ── IdP button ───────────────────────────────────────────── */
.idp-btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    color: #1a1a2e;
    transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.idp-btn:hover,
.idp-btn:focus-visible {
    background: #eef2ff;
    border-color: #4f46e5;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
    outline: none;
    transform: translateY(-1px);
}

.idp-btn:active {
    transform: translateY(0);
    background: #e0e7ff;
}

/* Logo or placeholder */
.idp-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 3px;
}

.idp-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #ffffff;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    user-select: none;
}

.idp-name {
    flex: 1;
    font-weight: 500;
    line-height: 1.3;
}

.idp-arrow {
    font-size: 1.25rem;
    color: #9ca3af;
    flex-shrink: 0;
    transition: color 0.15s;
}

.idp-btn:hover .idp-arrow,
.idp-btn:focus-visible .idp-arrow {
    color: #4f46e5;
}

/* ── Count label ──────────────────────────────────────────── */
.idp-count {
    font-size: 0.8rem;
    color: #9ca3af;
    text-align: right;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .disco-wrapper {
        padding: 1.75rem 1.25rem;
    }

    .disco-header h1 {
        font-size: 1.4rem;
    }
}
