@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #3e1053;
    --primary-light: #5a1e75;
    --accent-color: #fcc010;
    --text-dark: #1f2937;
    --text-light: #f3f4f6;
    --text-muted: #6b7280;
    --success-color: #059669;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --bg-gradient: linear-gradient(135deg, #2e0c3a 0%, #1a0524 100%);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========== Background Animation ========== */
.bg-animation {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    animation: orbFloat ease-in-out infinite;
}

.bg-orb-1 {
    width: 650px; height: 650px;
    background: radial-gradient(circle at center, rgba(123, 47, 168, 0.55), transparent 70%);
    top: -20%; left: -15%;
    animation-duration: 18s;
}
.bg-orb-2 {
    width: 550px; height: 550px;
    background: radial-gradient(circle at center, rgba(62, 16, 83, 0.6), transparent 70%);
    bottom: -15%; right: -10%;
    animation-duration: 22s;
    animation-delay: -8s;
}
.bg-orb-3 {
    width: 380px; height: 380px;
    background: radial-gradient(circle at center, rgba(252, 192, 16, 0.18), transparent 70%);
    top: 35%; left: 35%;
    animation-duration: 16s;
    animation-delay: -4s;
}
.bg-orb-4 {
    width: 450px; height: 450px;
    background: radial-gradient(circle at center, rgba(155, 89, 182, 0.35), transparent 70%);
    top: -5%; right: 15%;
    animation-duration: 24s;
    animation-delay: -13s;
}

@keyframes orbFloat {
    0%   { transform: translate(0,    0)    scale(1);    }
    20%  { transform: translate(45px, -55px) scale(1.07); }
    40%  { transform: translate(-35px, 45px) scale(0.93); }
    60%  { transform: translate(55px,  35px) scale(1.04); }
    80%  { transform: translate(-45px, -35px) scale(0.97); }
    100% { transform: translate(0,    0)    scale(1);    }
}

/* Floating particles (injected via JS) */
.bg-particle {
    position: absolute;
    bottom: -10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    animation: particleRise linear infinite;
    pointer-events: none;
}

@keyframes particleRise {
    0%   { transform: translateY(0)      scale(1);   opacity: 0; }
    5%   { opacity: 1; }
    90%  { opacity: 0.3; }
    100% { transform: translateY(-105vh) scale(0.4); opacity: 0; }
}

/* Utility Utilities */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
}

.dark-glass {
    background: rgba(30, 10, 45, 0.85);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Login Page --- */
.login-wrapper,
.dashboard-layout {
    position: relative;
    z-index: 1;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    width: 100%;
    max-width: 1200px;
    min-height: 700px;
    overflow: hidden;
    position: relative;
    animation: fadeInUp 0.8s ease-out;
}

.login-left {
    background: url('img/bangunan.jpg') center/cover;
    position: relative;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: white;
}

.login-left::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(62, 16, 83, 0.72), rgba(46, 12, 58, 0.76));
}

.login-left-content {
    position: relative;
    z-index: 10;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.brand-logo-right {
    justify-content: center;
    margin-left: 0;
    margin-right: 0;
}

.brand-logo-right .brand-text h1 {
    color: var(--primary-color);
}

.brand-logo img.brand-logo-img {
    height: 3.5rem;
    width: auto;
    object-fit: contain;
}

.brand-text h1 {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.brand-text span {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 300;
    letter-spacing: 1px;
}

.hero-message h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fff, #dadada);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tips-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    padding: 1.5rem;
    border-radius: 16px;
    border-left: 4px solid var(--accent-color);
    margin-top: 2rem;
}

.login-right {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form-wrapper {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.form-header {
    margin-bottom: 2rem;
    text-align: center;
}

.form-header h3 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Login tabs: Manual | Google SSO */
.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
}
.login-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: 0.25s;
}
.login-tab:hover {
    color: var(--primary-color);
}
.login-tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.login-tab-panel {
    display: none;
}
.login-tab-panel.active {
    display: block;
}

/* Google SSO panel */
.sso-panel {
    text-align: center;
}
.sso-desc {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}
.login-btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fff;
    color: #1f2937;
    border: 2px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.login-btn-google:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.login-btn-google svg {
    flex-shrink: 0;
}
.login-error-msg {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
    display: block;
}

.input-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    transition: 0.3s;
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: 0.3s;
    font-family: inherit;
}

.input-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(62, 16, 83, 0.1);
}

.input-group input:focus+i {
    color: var(--primary-color);
}

.password-wrapper {
    position: relative;
}
.password-wrapper input {
    padding-right: 2.5rem !important;
}
.password-toggle {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
}
.password-toggle:hover {
    color: #4b5563;
}

.login-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 12px rgba(62, 16, 83, 0.3);
}

.login-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(62, 16, 83, 0.4);
}

.password-strength {
    font-size: 0.8rem;
    color: #6b7280;
}
.password-strength-bar {
    height: 6px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
    margin-bottom: 0.35rem;
}
.password-strength-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: #ef4444;
    transition: width 0.25s ease, background-color 0.25s ease;
}
.password-strength-text {
    margin-bottom: 0.35rem;
}
.password-requirements {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.password-requirements li {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.2rem;
}
.password-requirements li::before {
    content: "•";
    font-size: 0.9rem;
    color: #9ca3af;
}
.password-requirements li.ok {
    color: #16a34a;
}
.password-requirements li.ok::before {
    content: "✓";
    color: #16a34a;
}
.password-strength--weak .password-strength-bar span {
    width: 33%;
    background: #ef4444;
}
.password-strength--medium .password-strength-bar span {
    width: 66%;
    background: #f97316;
}
.password-strength--strong .password-strength-bar span {
    width: 100%;
    background: #16a34a;
}

.quick-links {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.quick-link-hero {
    width: 100%;
    padding: 1.25rem 1rem;
    background: linear-gradient(135deg, rgba(62, 16, 83, 0.14) 0%, rgba(90, 30, 117, 0.08) 100%);
    border: 2px solid var(--primary-light);
    box-shadow: 0 0 0 0 rgba(62, 16, 83, 0.4);
    animation: quick-link-pulse 2s ease-in-out infinite;
    font-weight: 600;
    color: var(--primary-color);
}

.quick-link-hero i {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.quick-link-hero:hover {
    background: linear-gradient(135deg, rgba(62, 16, 83, 0.2) 0%, rgba(90, 30, 117, 0.12) 100%);
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(62, 16, 83, 0.35);
    animation: none;
}

.quick-link-hero:hover i {
    color: var(--primary-color);
}

@keyframes quick-link-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(62, 16, 83, 0.4); }
    50%  { box-shadow: 0 0 0 8px rgba(62, 16, 83, 0); }
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
}

.quick-link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.8rem;
    text-align: center;
    transition: 0.3s;
    border: 1px solid transparent;
}

.quick-link-item:hover {
    background: white;
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

.quick-link-item i {
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
    color: var(--primary-light);
}

/* --- Dashboard --- */
.dashboard-layout {
    display: block;
    min-height: 100vh;
}

/* Overlay sentiasa keluar dari grid (position: fixed) supaya tidak ambil sel grid pada desktop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

.sidebar {
    background: var(--glass-bg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    z-index: 1000;
    overflow: hidden;
    transform: translateX(calc(-100% + 6px));
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Tab visual pada strip yang kelihatan */
.sidebar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 48px;
    background: var(--primary-color);
    border-radius: 3px 0 0 3px;
    opacity: 0.4;
    transition: opacity 0.3s;
}

/* Desktop: hover untuk tunjuk sidebar */
@media (hover: hover) {
    .sidebar:hover {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }
    .sidebar:hover::after {
        opacity: 0;
    }
}

/* Mobile / JS-controlled */
.sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}
.sidebar.open::after {
    opacity: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
}
.sidebar-header h3 {
    font-size: 0;
    font-weight: 700;
}
.sidebar-header h3::after {
    content: "FMS UiTM";
    font-size: 1.2rem;
}
.sidebar-logo {
    height: 2.2rem;
    width: auto;
    object-fit: contain;
    display: block;
}

.user-profile {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 1.5rem;
    border-radius: 20px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 20px rgba(62, 16, 83, 0.2);
}

.avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
    overflow: hidden;
    flex-shrink: 0;
}
.avatar img.avatar-img {
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 50%;
}

.user-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.user-info span {
    font-size: 0.8rem;
    opacity: 0.8;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    color: #6b7280;
    text-decoration: none;
    border-radius: 12px;
    transition: 0.3s;
    font-weight: 500;
}

.nav-item.active a,
.nav-item a:hover {
    background: rgba(62, 16, 83, 0.08);
    color: var(--primary-color);
}

.main-content {
    padding: 2rem 3rem;
    overflow-y: auto;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3rem;
}

.welcome-text h2 {
    font-size: 2rem;
    color: white;
    /* On dark bg */
    margin-bottom: 0.5rem;
}

.welcome-text p {
    color: rgba(255, 255, 255, 0.8);
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    padding-bottom: 2rem;
    animation: fadeIn 1s ease-out;
}
.app-card {
    background: var(--glass-bg);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    height: 100%;
}
.app-card .app-icon,
.app-card > span {
    align-self: center;
}
.app-card .app-desc {
    align-self: stretch;
    width: 100%;
}
.app-card .app-desc ul,
.app-card .app-desc ol {
    text-align: left;
}

.app-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-light);
}

.app-icon {
    width: 70px;
    height: 70px;
    min-width: 70px;
    min-height: 70px;
    flex-shrink: 0;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    transition: 0.3s;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.app-icon i {
    font-size: 1.8rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-desc {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.5rem;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
}
.app-desc ul, .app-desc ol {
    margin: 0.35em 0 0 0;
    padding-left: 1.1em;
    font-size: 0.78rem;
}
.app-desc li {
    margin: 0.2em 0;
}

/* Specific App Colors - Removed in favor of inline gradients in HTML */
/* 
.app-card:nth-child(1) .app-icon { ... }
*/

.app-card span {
    font-weight: 600;
    font-size: 1rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Visitor Counter */
.visitor-counter {
    background: #000;
    color: #0f0;
    font-family: 'Courier New', monospace;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    display: inline-block;
    letter-spacing: 4px;
    font-weight: bold;
    margin-top: 1rem;
    border: 2px solid #333;
}

/* ========== RESPONSIVE: Mobile & Tablet ========== */
/* Pastikan tap target minimum ~44px untuk aksesibiliti sentuhan */
@media (max-width: 1024px) {
    .container {
        padding: 0 1rem;
    }

    .main-content {
        padding: 1.5rem 1.5rem;
    }

    .apps-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .welcome-text h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .login-wrapper {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 1.5rem;
    }

    .login-container {
        grid-template-columns: 1fr;
        max-width: 100%;
        min-height: auto;
    }

    .login-left {
        min-height: 180px;
        padding: 1.5rem;
        justify-content: center;
    }

    .login-left .hero-message h2 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .tips-card {
        display: none;
    }

    .login-right {
        padding: 1.5rem;
    }

    .brand-logo {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .brand-logo img.brand-logo-img {
        height: 2.5rem;
    }

    .brand-text h1 {
        font-size: 1.25rem;
        text-align: center;
    }

    .form-header h3 {
        font-size: 1.5rem;
    }

    .login-tab {
        padding: 0.85rem 0.5rem;
        font-size: 0.9rem;
    }

    .quick-links-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-link-item {
        padding: 1rem 0.5rem;
        font-size: 0.75rem;
    }

    .visitor-counter {
        font-size: 0.9rem;
        padding: 0.4rem 0.75rem;
        letter-spacing: 2px;
    }

    .main-content {
        padding: 1rem;
        width: 100%;
    }

    .top-bar {
        flex-wrap: wrap;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .top-bar .welcome-text {
        flex: 1;
        min-width: 0;
    }

    .top-bar .welcome-text h2 {
        font-size: 1.25rem;
    }

    .top-bar .welcome-text p {
        font-size: 0.9rem;
    }

    .top-bar .glass-panel {
        width: 100%;
        justify-content: center;
    }

    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding-bottom: 1rem;
    }

    .app-card {
        padding: 1.25rem;
    }

    .app-icon {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
        font-size: 1.4rem;
        margin-bottom: 0.75rem;
    }

    .app-card span {
        font-size: 0.9rem;
    }

    .app-desc {
        font-size: 0.75rem;
    }

    .app-desc ul, .app-desc ol {
        font-size: 0.72rem;
    }

    .nav-item a {
        padding: 1rem;
        min-height: 44px;
    }

    .user-profile {
        padding: 1rem;
    }

    .avatar {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .login-wrapper {
        padding: 0.75rem;
    }

    .login-left {
        min-height: 140px;
    }

    .login-left .hero-message h2 {
        font-size: 1.4rem;
    }

    .quick-links-grid {
        grid-template-columns: 1fr;
    }

    .apps-grid {
        grid-template-columns: 1fr;
    }

    .app-card {
        padding: 1rem;
    }

    .sidebar {
        width: 100%;
        max-width: 100%;
    }
}

.menu-toggle {
    display: none !important;
}