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

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --dark: #0f172a;
    --light: #f8fafc;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-soft: #64748b;
    --overlay: rgba(15, 17, 42, 0.08);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    font-weight: 700;
}

/* ============ LOGIN PAGE ============ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.login-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    z-index: 10;
}

.login-bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.55;
}

.deco-blob {
    position: absolute;
    border-radius: 100%;
    opacity: 0.05;
    filter: blur(90px);
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #fbbf24;
    top: -100px;
    right: -100px;
    animation: none;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #60a5fa;
    bottom: -80px;
    left: -80px;
    animation: none;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #34d399;
    top: 50%;
    left: 10%;
    animation: none;
}

@keyframes blob-move1 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-30px, 40px); }
    66% { transform: translate(30px, -20px); }
}

@keyframes blob-move2 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(20px, -30px); }
    66% { transform: translate(-40px, 20px); }
}

@keyframes blob-move3 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-20px, -30px); }
    66% { transform: translate(40px, 30px); }
}

.login-wrapper {
    position: relative;
    z-index: 1;
}

.login-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 40px 30px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    animation: fadeInUp 350ms ease;
}

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

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 140px;
    height: 140px;
    object-fit: contain;
    display: block;
    margin: 0 auto 24px auto;
    animation: none;
}

.login-header h1 {
    font-size: 32px;
    color: #1e293b;
    margin-bottom: 4px;
}

.login-header .subtitle {
    font-size: 14px;
    color: var(--text-soft);
    font-weight: 400;
}

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 300ms ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.alert-icon {
    font-size: 18px;
    font-weight: 700;
}

.alert-error {
    background: #fee2e2;
    color: #7f1d1d;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bfdbfe;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    position: relative;
}

.form-group input {
    width: 100%;
    height: 48px;
    border: 1px solid #d5dde8;
    border-radius: 12px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--light);
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
    outline: none;
}

.form-group input::placeholder {
    color: var(--text-soft);
}

.form-group input:focus,
.form-group.focused input {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-group input:hover:not(:focus) {
    border-color: #cbd5e1;
}

.captcha-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.captcha-box {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.captcha-image {
    flex: 1;
    height: 52px;
    border: 1px solid #d5dde8;
    border-radius: 12px;
    background: var(--light);
    object-fit: contain;
    padding: 2px;
}

.captcha-refresh-btn {
    width: 48px;
    height: 48px;
    border: 1px solid #d5dde8;
    border-radius: 12px;
    background: var(--light);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 300ms ease;
    font-size: 0;
}

.captcha-refresh-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.06);
}

.captcha-refresh-btn svg {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.login-btn {
    height: 48px;
    border: 0;
    border-radius: 12px;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 180ms ease;
    box-shadow: none;
}

.login-btn:hover {
    background: #1d4ed8;
}

.login-btn svg {
    width: 18px;
    height: 18px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
}

.demo-info {
    font-size: 13px;
    color: var(--text-soft);
    background: #f8fafc;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: none;
}

.copyright-text {
    font-size: 12px;
    color: var(--text-soft);
    margin: 0;
    margin-top: 16px;
    letter-spacing: 0.3px;
}

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    border-bottom: 2px solid #e2e8f0;
    justify-content: center;
}

.login-tab-btn {
    padding: 12px 16px;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 200ms ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-tab-btn:hover {
    color: var(--text);
    background: rgba(37, 99, 235, 0.04);
}

.login-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.login-tab-content {
    display: none;
    animation: fadeIn 200ms ease;
}

.login-tab-content.active {
    display: block;
}

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

.asset-search-results {
    margin-top: 24px;
}

.search-loading,
.search-no-results,
.search-error {
    text-align: center;
    font-size: 14px;
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.search-loading {
    color: var(--text-soft);
    background: #f1f5f9;
}

.search-no-results {
    color: var(--text-soft);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.search-error {
    color: #7f1d1d;
    background: #fee2e2;
    border: 1px solid #fecaca;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    background: #ffffff;
    transition: all 200ms ease;
}

.search-result-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.result-header strong {
    font-size: 15px;
    color: #1e293b;
}

.result-code {
    background: #f1f5f9;
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-details p {
    margin: 0;
    font-size: 13px;
    color: var(--text);
    display: flex;
    gap: 8px;
}

.result-details .label {
    color: var(--text-soft);
    font-weight: 600;
    min-width: 90px;
}

.status-active {
    color: #16a34a;
    font-weight: 600;
}

.status-inactive {
    color: #dc2626;
    font-weight: 600;
}

.page-dashboard .topbar {
    max-width: 1120px;
    margin: 0 auto;
    padding: 20px 24px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand-mini {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #0b4c47;
}

.brand-mini img {
    width: 44px;
    height: 44px;
}

.user-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-meta small {
    color: #496d72;
}

.page-dashboard .dashboard-shell {
    max-width: 1120px;
    margin: 0 auto;
    padding: 18px 24px 34px;
}

.hero-box {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid #e6f2ef;
    border-radius: 22px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.hero-box h1 {
    font-family: 'Spectral', serif;
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    color: #0d4f49;
}

.hero-box p {
    margin-top: 8px;
    color: #315f65;
}

.module-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 14px;
}

.module-card {
    background: #fff;
    border: 1px solid #e7f4f1;
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(10, 66, 70, 0.08);
    animation: rise 700ms ease;
}

.module-card h3 {
    margin-bottom: 10px;
}

.perm-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.perm {
    border-radius: 999px;
    padding: 6px 11px;
    font-size: 0.84rem;
    font-weight: 700;
}

.perm.ok {
    background: var(--ok-bg);
    color: var(--ok-text);
}

.perm.no {
    background: var(--no-bg);
    color: var(--no-text);
}

.actions-row {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.actions-row button {
    background: #eaf9f6;
    color: #14534d;
}

.actions-row button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@keyframes rise {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 900px) {
    .page-login .login-shell {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .branding-panel,
    .form-panel .card {
        padding: 24px;
    }

    .page-dashboard .topbar,
    .page-dashboard .dashboard-shell {
        padding-left: 16px;
        padding-right: 16px;
    }

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

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-dialog {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: translateY(-20px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border);
    user-select: text;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-soft);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.modal-close:hover { background: var(--border); }

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 24px 20px;
    border-top: 1px solid var(--border);
}

/* ============ SIDEBAR SECTION LABELS ============ */
.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    padding: 16px 16px 4px;
    pointer-events: none;
}

/* ============ TAB UI ============ */
.tab-link {
    display: inline-block;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-soft);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.tab-link:hover { color: var(--primary); }
.tab-link.tab-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============ FILTER BAR ============ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.filter-input, .filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: #f8fafc;
    min-width: 160px;
}

.btn-filter {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-reset {
    color: var(--text-soft);
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* ============ MOBILE: TABLE → CARDS ============ */
@media (max-width: 768px) {
    .module-table table,
    .module-table thead,
    .module-table tbody,
    .module-table th,
    .module-table td,
    .module-table tr {
        display: block;
    }

    .module-table thead { display: none; }

    .module-table tr {
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 1px 6px rgba(0,0,0,0.08);
        margin-bottom: 12px;
        padding: 14px 16px;
        border: 1px solid var(--border);
    }

    .module-table td {
        padding: 5px 0;
        border: none;
        display: flex;
        align-items: flex-start;
        gap: 8px;
        font-size: 13px;
    }

    .module-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-soft);
        min-width: 100px;
        flex-shrink: 0;
    }

    .module-table td.actions-cell {
        flex-wrap: wrap;
        gap: 6px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-input, .filter-select {
        width: 100%;
        min-width: unset;
    }

    .module-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .modal-dialog {
        max-width: 100%;
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
    }

    .modal-overlay {
        align-items: flex-end;
    }
}
