:root {
    --primary-color: #0083B0; /* Cyan */
    --secondary-color: #5D6D7E; /* Slate Gray */
    --accent-color: #EBF5FB; /* Light Cyan/Gray */
    --text-dark: #2C3E50;
    --text-muted: #7F8C8D;
    --bg-color: #F8F9FA;
    --card-bg: #FFFFFF;
    --card-shadow: 0 10px 30px rgba(0, 131, 176, 0.08);
    --card-shadow-hover: 0 15px 40px rgba(0, 180, 219, 0.15);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --ink: #0b2430;
    --teal-deep: #04607f;
}

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body.portal-locked {
    overflow: hidden;
}

@media (max-width: 992px) {
    body.portal-locked {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
}

body.portal-locked #portal-app,
#portal-app[hidden] {
    display: none !important;
}

body.portal-open #login-screen,
#login-screen[hidden] {
    display: none !important;
}

/* Login Screen — split navy/gold */
.login-screen {
    min-height: 100dvh;
    position: relative;
    z-index: 1000;
    background: #071526;
}

.login-split {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1.15fr 0.95fr;
}

.login-visual {
    position: relative;
    overflow: hidden;
    min-height: 100dvh;
}

.login-visual-photo {
    position: absolute;
    inset: 0;
    background-image: url('images/campus-night.png');
    background-repeat: no-repeat;
    background-size: 185% 100%;
    background-position: left center;
    transform: scale(1.02);
}

.login-visual-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 55%, rgba(7, 21, 38, 0.55) 100%);
    pointer-events: none;
}

.login-curve {
    position: absolute;
    top: 0;
    bottom: 0;
    left: auto;
    right: -2px;
    width: 72px;
    background: #071526;
    clip-path: ellipse(100% 70% at 100% 50%);
    border-right: 2px solid #c9a227;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.login-panel {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: #071526;
    padding: 28px 22px;
    min-height: 100dvh;
}

.login-panel-frame {
    width: min(100%, 460px);
    margin: auto;
    border: 1.5px solid rgba(201, 162, 39, 0.75);
    border-radius: 18px;
    padding: 18px;
    box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.18);
}

.login-panel-inner {
    text-align: center;
    padding: 18px 14px 10px;
}

.login-brand-block {
    margin-bottom: 22px;
}

.login-logo {
    width: 176px;
    height: auto;
    max-height: 168px;
    object-fit: contain;
    margin: 0 auto 14px;
    display: block;
    background: transparent;
    border-radius: 0;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

.login-uni-title {
    margin: 0;
    color: #e0b93d;
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    font-size: clamp(1.05rem, 1.9vw, 1.35rem);
    font-weight: 800;
    line-height: 1.5;
}

.login-uni-tag {
    margin: 8px 0 0;
    color: rgba(220, 230, 240, 0.72);
    font-size: 0.95rem;
    font-weight: 500;
}

.login-form-title {
    margin: 8px 0 18px;
    color: #e0b93d;
    font-size: 1.15rem;
    font-weight: 700;
}

.login-form {
    display: grid;
    gap: 14px;
    text-align: right;
}

.login-form .form-field {
    margin: 0;
}

.login-form .input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(18, 36, 58, 0.95);
    border: 1px solid rgba(160, 180, 200, 0.28);
    border-radius: 12px;
    padding: 0 12px;
    transition: var(--transition);
}

.login-form .input-wrap:focus-within {
    border-color: rgba(224, 185, 61, 0.75);
    box-shadow: 0 0 0 3px rgba(224, 185, 61, 0.15);
}

.login-form .input-wrap input {
    flex: 1;
    border: 0;
    background: transparent;
    outline: none;
    padding: 14px 4px;
    font-family: inherit;
    font-size: 16px;
    color: #f2f6fa;
    min-width: 0;
    text-align: right;
}

.login-form .input-wrap input::placeholder {
    color: rgba(180, 195, 210, 0.65);
}

.login-form .input-icon {
    color: rgba(210, 220, 230, 0.85);
    font-size: 1.05rem;
    order: 3;
}

.login-form .toggle-pass {
    order: 1;
    border: 0;
    background: transparent;
    color: rgba(190, 205, 220, 0.8);
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.login-form .toggle-pass:hover {
    color: #e0b93d;
}

.remember-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-self: start;
    color: rgba(210, 220, 230, 0.85);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.remember-row input {
    width: 16px;
    height: 16px;
    accent-color: #c9a227;
    cursor: pointer;
}

.login-error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(180, 35, 24, 0.18);
    border: 1px solid rgba(255, 120, 100, 0.35);
    color: #ffb4a8;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
}

.login-btn {
    width: 100%;
    border: 0;
    border-radius: 14px;
    padding: 13px 18px;
    background: linear-gradient(90deg, #f0d36a 0%, #d4a017 55%, #c4890a 100%);
    color: #0b1f3a;
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 24px rgba(201, 162, 39, 0.28);
}

.login-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
}

.forgot-link {
    border: 0;
    background: transparent;
    color: rgba(170, 190, 210, 0.75);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: default;
    padding: 0;
    margin: 2px 0 8px;
}

.login-secure {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(190, 200, 215, 0.7);
    font-size: 0.88rem;
}

.login-secure i {
    color: #d4a017;
    font-size: 1rem;
}

.logout-btn {
    position: absolute;
    top: 0;
    left: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 999px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

@media (max-width: 992px) {
    .login-screen {
        min-height: 100dvh;
        min-height: 100svh;
    }

    .login-split {
        grid-template-columns: 1fr;
        min-height: 100dvh;
        min-height: 100svh;
    }

    .login-visual {
        min-height: clamp(140px, 26vh, 220px);
        max-height: none;
        order: -1;
    }

    .login-visual-photo {
        background-size: cover;
        background-position: center 30%;
        transform: none;
    }

    .login-visual-shade {
        background: linear-gradient(180deg, transparent 35%, rgba(7, 21, 38, 0.92) 100%);
    }

    .login-curve {
        display: block;
        top: auto;
        bottom: -1px;
        left: 0;
        right: 0;
        width: 100%;
        height: 36px;
        clip-path: ellipse(75% 100% at 50% 100%);
        border-right: 0;
        border-top: 2px solid #c9a227;
        box-shadow: none;
    }

    .login-panel {
        min-height: auto;
        padding: 8px 14px calc(20px + env(safe-area-inset-bottom, 0px));
        align-items: flex-start;
    }

    .login-panel-frame {
        width: 100%;
        max-width: 440px;
        margin: 0 auto;
        padding: 12px;
        border-radius: 16px;
    }

    .login-panel-inner {
        padding: 12px 8px 8px;
    }

    .login-brand-block {
        margin-bottom: 14px;
    }

    .login-logo {
        width: 132px;
        height: auto;
        max-height: 126px;
        margin-bottom: 10px;
    }

    .login-uni-title {
        font-size: clamp(1.05rem, 4.6vw, 1.3rem);
        padding: 0 4px;
    }

    .login-uni-tag {
        font-size: 0.88rem;
        margin-top: 6px;
    }

    .login-form-title {
        margin: 4px 0 14px;
        font-size: 1.05rem;
    }

    .login-form {
        gap: 12px;
    }

    .login-form .input-wrap {
        min-height: 48px;
        border-radius: 12px;
        padding: 0 12px;
    }

    .login-form .input-wrap input {
        padding: 12px 4px;
        font-size: 16px;
    }

    .login-btn {
        min-height: 48px;
        font-size: 1.08rem;
        border-radius: 12px;
        margin-top: 2px;
    }

    .remember-row {
        font-size: 0.9rem;
        min-height: 28px;
    }

    .remember-row input {
        width: 18px;
        height: 18px;
    }

    .login-secure {
        margin-top: 14px;
        font-size: 0.82rem;
    }
}

@media (max-width: 480px) {
    .login-visual {
        min-height: clamp(120px, 22vh, 180px);
    }

    .login-logo {
        width: 118px;
        height: auto;
        max-height: 112px;
    }

    .login-uni-title {
        font-size: 1.08rem;
        line-height: 1.4;
    }

    .login-panel {
        padding-inline: 12px;
    }

    .login-panel-frame {
        padding: 10px;
    }

    .login-panel-inner {
        padding: 8px 4px 4px;
    }

    .forgot-link {
        font-size: 0.85rem;
    }
}

@media (max-width: 992px) and (max-height: 700px) {
    .login-visual {
        min-height: 110px;
    }

    .login-logo {
        width: 104px;
        height: auto;
        max-height: 98px;
        margin-bottom: 6px;
    }

    .login-brand-block {
        margin-bottom: 8px;
    }

    .login-uni-tag {
        display: none;
    }

    .login-form-title {
        margin-bottom: 10px;
    }
}

/* Header Styles */
.portal-header {
    background: linear-gradient(135deg, #0083B0 0%, #5D6D7E 100%);
    color: white;
    padding: 80px 0 60px;
    border-bottom-left-radius: 40px;
    border-bottom-right-radius: 40px;
    box-shadow: 0 10px 30px rgba(0, 131, 176, 0.2);
    position: relative;
    overflow: hidden;
}

/* Background decorative circles */
.portal-header::before,
.portal-header::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.portal-header::before {
    width: 300px;
    height: 300px;
    top: -100px;
    right: -100px;
}

.portal-header::after {
    width: 400px;
    height: 400px;
    bottom: -150px;
    left: -150px;
}

.logo-container {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 80px;
    height: 80px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.main-logo-icon {
    font-size: 2.5rem;
    color: white;
}

.main-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.sub-title {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.description {
    max-width: 700px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.15rem;
    line-height: 1.7;
}

/* Cards Section */
.portal-cards-section {
    position: relative;
    z-index: 10;
    margin-top: -30px;
}

.portal-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.portal-card {
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 30px 25px;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Hover Effect Line at bottom */
.portal-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    transform: scaleX(0);
    transition: var(--transition);
    transform-origin: right;
}

.portal-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(0, 123, 255, 0.1);
}

.portal-card:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.icon-wrapper {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    background-color: var(--accent-color);
    color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    margin-bottom: 20px;
    transition: var(--transition);
}

.portal-card:hover .icon-wrapper {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.05) rotate(-5deg);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.5;
    margin-bottom: 15px;
    flex-grow: 1;
}

.card-arrow {
    color: var(--secondary-color);
    font-size: 1.5rem;
    opacity: 0.5;
    transition: var(--transition);
    transform: translateX(0);
    margin-top: auto;
}

.portal-card:hover .card-arrow {
    opacity: 1;
    transform: translateX(-10px);
}

/* Footer */
.portal-footer {
    background-color: #ffffff;
    border-top: 1px solid rgba(0,0,0,0.05);
    margin-top: 50px;
}

.contact-links {
    margin: 20px 0;
}

.contact-email {
    display: inline-flex;
    align-items: center;
    background-color: var(--accent-color);
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.contact-email:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 131, 176, 0.15);
    border-color: rgba(0,0,0,0.05);
}

.copyright {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Performance Table Page */
.performance-section {
    position: relative;
    z-index: 10;
    margin-top: -20px;
}

.performance-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.performance-card-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--accent-color);
}

.performance-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.6;
    margin-bottom: 12px;
}

.performance-desc {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 0;
}

.performance-table-wrap {
    border-radius: 12px;
    border: 1px solid rgba(0, 131, 176, 0.12);
}

.performance-table {
    font-size: 0.92rem;
    margin-bottom: 0;
}

.performance-table thead th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    vertical-align: middle;
    padding: 14px 10px;
    font-weight: 700;
    border: none;
    white-space: nowrap;
}

.performance-table tbody td {
    text-align: center;
    vertical-align: middle;
    padding: 12px 10px;
    border-color: rgba(0, 0, 0, 0.06);
}

.performance-table tbody tr:nth-child(even) {
    background-color: rgba(235, 245, 251, 0.4);
}

.performance-table tbody tr:hover {
    background-color: rgba(0, 131, 176, 0.06);
}

.category-cell {
    background-color: rgba(0, 131, 176, 0.08) !important;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 180px;
    max-width: 220px;
    line-height: 1.5;
}

.indicator-cell {
    min-width: 200px;
    text-align: right !important;
}

.significance-cell {
    min-width: 260px;
    max-width: 320px;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-dark);
}

.expected-cell {
    color: var(--primary-color);
    background-color: rgba(0, 131, 176, 0.05);
}

.change-up {
    color: #198754;
    font-weight: 700;
}

.change-down {
    color: #dc3545;
    font-weight: 700;
}

.admin-actions {
    white-space: nowrap;
}

.admin-bar {
    min-height: 38px;
}

/* Table icon selector */
.table-icon-card {
    background: var(--card-bg);
    border: 2px solid rgba(0, 131, 176, 0.12);
    border-radius: 20px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--card-shadow);
    color: inherit;
}

.table-icon-card:hover,
.table-icon-card.active {
    transform: translateY(-6px);
    border-color: var(--primary-color);
    box-shadow: var(--card-shadow-hover);
}

.table-icon-card.active {
    background: linear-gradient(180deg, rgba(0, 131, 176, 0.06) 0%, var(--card-bg) 100%);
}

.table-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    border-radius: 20px;
    background: var(--accent-color);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    transition: var(--transition);
}

.table-icon-wrapper.icon-journals {
    background: rgba(93, 109, 126, 0.12);
    color: var(--secondary-color);
}

.table-icon-card.active .table-icon-wrapper {
    background: var(--primary-color);
    color: white;
}

.table-icon-card.active .table-icon-wrapper.icon-journals {
    background: var(--secondary-color);
    color: white;
}

.table-icon-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.table-icon-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

.table-icon-sub span {
    font-weight: 600;
    color: var(--text-dark);
}

.table-icon-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-color);
    background: var(--accent-color);
    padding: 6px 14px;
    border-radius: 50px;
}

.table-icon-card.active .table-icon-badge {
    background: rgba(0, 131, 176, 0.15);
    color: var(--primary-color);
}

.expand-icon {
    transition: transform 0.25s ease;
}

.table-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.45s ease, opacity 0.35s ease, margin 0.35s ease;
    margin-bottom: 0;
}

.table-panel.show {
    max-height: 8000px;
    opacity: 1;
    margin-bottom: 1.5rem;
}

.journal-name-cell {
    background-color: rgba(0, 131, 176, 0.1) !important;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 160px;
    vertical-align: middle !important;
    line-height: 1.5;
}

.scopus-cell {
    min-width: 200px;
    max-width: 260px;
    background-color: rgba(235, 245, 251, 0.6);
    line-height: 1.6;
    vertical-align: middle !important;
}

.journal-table tbody tr.total-row {
    background-color: rgba(0, 131, 176, 0.12) !important;
    font-weight: 700;
}

.journal-table tbody tr.total-row td {
    border-top: 2px solid var(--primary-color);
}

.journal-table tbody tr.total-note-row td {
    background-color: rgba(0, 131, 176, 0.05);
    border-bottom: 2px solid rgba(0, 131, 176, 0.2);
    padding-top: 0;
    padding-bottom: 12px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .performance-card {
        padding: 20px 15px;
    }
    .performance-title {
        font-size: 1.15rem;
    }
    .portal-header {
        padding: 72px 0 40px;
        border-bottom-left-radius: 28px;
        border-bottom-right-radius: 28px;
    }
    .main-title {
        font-size: clamp(1.35rem, 6vw, 1.85rem);
        padding: 0 8px;
        line-height: 1.45;
    }
    .sub-title {
        font-size: 1.2rem !important;
    }
    .description {
        font-size: 0.98rem;
        padding: 0 12px;
    }
    .portal-card {
        padding: 22px 18px;
    }
    .card-title {
        font-size: 1.08rem;
    }
    .logout-btn {
        top: -8px;
        left: 0;
        padding: 7px 12px;
        font-size: 0.82rem;
    }
    .contact-email {
        width: 100%;
        justify-content: center;
        font-size: 0.95rem;
    }
}

@media (max-width: 420px) {
    .icon-wrapper {
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
    }
    .portal-cards-section {
        margin-top: -20px;
        padding-top: 1.5rem !important;
    }
}

@media (hover: none) {
    .portal-card:hover {
        transform: none;
    }
}
