/* style.css */
:root {
    --bg-dark: #0a0a0f;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.1), transparent 25%);
}

.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Glassmorphism Panel Base */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Login Screen */
#login-screen {
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-box {
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.logo-area {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary);
    animation: pulse 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

.main-logo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    z-index: 2;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.input-group {
    position: relative;
    margin-bottom: 25px;
    text-align: left;
}

.input-group input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 15px 15px 15px 15px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.input-group label {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: 0.3s;
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
    top: -10px;
    left: 10px;
    font-size: 0.8rem;
    background: var(--bg-dark);
    padding: 0 5px;
    color: var(--primary);
}

.glow-button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* Modifiers for the header buttons so they don't take 100% width */
.access-sections h2 + .glow-button {
    width: auto;
    padding: 10px 20px;
    font-size: 0.9rem;
    border-radius: 6px;
}

.glow-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.7);
}

.error-msg {
    color: var(--danger);
    margin-top: 15px;
    font-size: 0.9rem;
    min-height: 20px;
}

/* Dashboard Layout */
#dashboard-screen {
    width: 100vw;
    height: 100vh;
    display: none;
}

#dashboard-screen.active {
    display: flex;
}

.sidebar {
    width: 280px;
    height: 100vh;
    border-radius: 0;
    border-left: none;
    border-top: none;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
}

.admin-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.2s;
}
.icon-btn:hover {
    transform: scale(1.1);
}

.nav-links {
    list-style: none;
    margin-top: 20px;
}

.nav-links li a {
    display: block;
    padding: 15px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: 0.3s;
    border-left: 3px solid transparent;
}

.nav-links li:hover a, .nav-links li.active a {
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
    border-left-color: var(--primary);
}

.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.overview h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

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

.stat-pill {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.pulse-dot.green {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.saas-card {
    padding: 25px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.saas-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: 0.3s;
    pointer-events: none;
}

.saas-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4), 0 0 20px rgba(99, 102, 241, 0.2);
}

.saas-card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.card-logo {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: contain;
    background: transparent;
    padding: 0;
    transition: var(--transition);
}

.logo-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
}

.logo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    border-radius: 12px;
}

.logo-overlay svg {
    width: 20px;
    height: 20px;
}

.logo-wrapper:hover .logo-overlay {
    opacity: 1;
}

.logo-wrapper:hover .card-logo {
    transform: scale(1.05);
}

.card-title h3 {
    font-size: 1.2rem;
}
.card-title .status {
    font-size: 0.8rem;
    color: var(--success);
}

.card-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

.stat-item {
    text-align: center;
}
.stat-item .val {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
}
.stat-item .lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--danger);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
    border: 2px solid var(--bg-dark);
}

.sso-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--text-main);
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 600;
}

.saas-card:hover .sso-btn {
    background: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* SSO Loading Overlay */
.sso-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.sso-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin-bottom: 20px;
}

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

/* Access Tables */
.table-responsive {
    overflow-x: auto;
}

.access-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: 10px;
}

.access-table th {
    padding: 12px 15px;
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    border: none;
    background: transparent;
}

.access-table td {
    padding: 16px 15px;
    border: none;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.access-table td:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.access-table td:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.access-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.002);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-right: 5px;
    position: relative;
    z-index: 10;
}

.action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 12px var(--primary-glow);
}

.action-btn.delete-btn {
    background: rgba(255, 107, 107, 0.1);
    color: #ff8787;
    border-color: rgba(255, 107, 107, 0.4);
}

.action-btn.delete-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.5);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-box {
    width: 100%;
    max-width: 450px;
    padding: 30px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger);
}

.modal-box h2 {
    margin-bottom: 20px;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* TICKET NOTIFICATIONS */
.global-bell-container { position: absolute; top: 30px; right: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--glass-bg); border: 1px solid var(--glass-border); transition: 0.3s; z-index: 100; }
.global-bell-container:hover { transform: scale(1.1); }
.global-bell-icon { font-size: 1.5rem; }
.bell-ringing { animation: bellShake 1s infinite; }
.global-badge { position: absolute; top: -5px; right: -5px; background: #ef4444; color: #fff; font-size: 0.75rem; font-weight: bold; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 10px rgba(239, 68, 68, 0.6); display: none; }
.ticket-badge { position: absolute; top: 15px; right: 15px; background: #ef4444; color: #fff; font-size: 0.8rem; font-weight: bold; padding: 4px 10px; border-radius: 20px; box-shadow: 0 0 10px rgba(239, 68, 68, 0.6); animation: pulse-red 2s infinite; cursor: pointer; z-index: 10; display: none; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
@keyframes bellShake { 0% { transform: rotate(0); } 10% { transform: rotate(15deg); } 20% { transform: rotate(-15deg); } 30% { transform: rotate(10deg); } 40% { transform: rotate(-10deg); } 50% { transform: rotate(5deg); } 60% { transform: rotate(-5deg); } 70% { transform: rotate(0); } 100% { transform: rotate(0); } }
