/* ============================================
   PKR SSO — Premium Light Theme
   ============================================ */

:root {
    --primary: #0d9488;
    /* Tosca/Teal */
    --primary-light: #2dd4bf;
    --primary-dark: #0f766e;
    --accent: #06b6d4;
    /* Cyan */
    --accent-light: #67e8f9;
    --bg-light: #ffffff;
    /* Pure White */
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --text-primary: #134e4a;
    /* Dark Teal for text */
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border: rgba(13, 148, 136, 0.15);
    --border-focus: rgba(13, 148, 136, 0.5);
    --error: #ef4444;
    --error-bg: #fee2e2;
    --success: #10b981;
    --shadow: 0 25px 50px -12px rgba(13, 148, 136, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Animated Background ---- */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    background: radial-gradient(circle at top left, #f0fdfa, transparent 40%),
        radial-gradient(circle at bottom right, #ecfeff, transparent 40%);
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.bg-circle-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #ccfbf1, #99f6e4);
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.bg-circle-2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #cffafe, #a5f3fc);
    bottom: -150px;
    left: -150px;
    animation-delay: -7s;
}

.bg-circle-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -50px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 30px) scale(0.95);
    }

    75% {
        transform: translate(40px, 20px) scale(1.02);
    }
}

/* ---- Container ---- */
.sso-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 20px;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Brand ---- */
.sso-brand {
    text-align: center;
    margin-bottom: 32px;
}

.sso-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    animation: pulse 3s ease-in-out infinite;
}

.sso-logo svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.2));
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.sso-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.sso-title span {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sso-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
    margin-top: 4px;
}

/* ---- Card ---- */
.sso-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid white;
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    animation: cardAppear 0.5s ease-out 0.2s both;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.97);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---- Alert ---- */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    margin-bottom: 20px;
    transition: var(--transition);
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #b91c1c;
}

.alert-icon {
    flex-shrink: 0;
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #b91c1c;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* ---- Role Tabs ---- */
.role-tabs {
    display: flex;
    position: relative;
    background: rgba(13, 148, 136, 0.05);
    /* Very light primary tint */
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 28px;
    border: 1px solid var(--border);
}

.role-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.role-tab:hover {
    color: var(--text-secondary);
}

.role-tab.active {
    color: white;
    /* White text on active tab */
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.3);
}

.tab-icon {
    font-size: 1.1rem;
}

.tab-label {
    font-weight: 600;
}

/* ---- Form ---- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    font-size: 1.1rem;
    z-index: 1;
    pointer-events: none;
    color: var(--text-muted);
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

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

.input-wrapper input:focus {
    border-color: var(--border-focus);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    transition: transform 0.2s;
    color: var(--text-muted);
}

.toggle-password:hover {
    transform: scale(1.1);
    color: var(--text-secondary);
}

/* ---- Target Options ---- */
.target-group {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.target-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.target-option input {
    display: none;
}

.target-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.target-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.target-option input:checked+.target-card {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    /* Subtle tint on active */
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.target-icon {
    font-size: 1.4rem;
}

.target-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.target-option input:checked+.target-card .target-name {
    color: var(--primary);
}

/* ---- Buttons ---- */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    margin-top: 4px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.btn-secondary:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.btn-logout {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 8px;
}

.btn-logout:hover {
    color: var(--error);
}

.btn-icon {
    font-size: 1.1rem;
}

.btn-text,
.btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Logged In View ---- */
.logged-in-info {
    text-align: center;
    margin-bottom: 24px;
}

.user-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0 auto 16px;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
    border: 2px solid white;
}

.logged-in-info h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--success);
}

.user-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.user-role-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
}

.user-role-badge.student {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    /* Darker green for light mode visibility */
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.user-role-badge.employee {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    /* Darker primary for light mode */
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.quick-links {
    margin-bottom: 8px;
}

.quick-links-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}



/* ---- Footer ---- */
.sso-footer {
    text-align: center;
    margin-top: 24px;
}

.sso-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .sso-container {
        padding: 16px;
    }

    .sso-card {
        padding: 24px 20px;
    }

    .sso-title {
        font-size: 1.75rem;
    }

    .role-tab {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .target-options {
        grid-template-columns: 1fr;
    }
}