/* ============================================================
   CLIENT PORTAL — petzerhiel.lu
   Dark/blur theme matching the main site aesthetic
   ============================================================ */

/* ─── Layout ─────────────────────────────────────────────── */
.portal-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: 56px; /* topbar height */
}

/* ─── Sidebar ────────────────────────────────────────────── */
.portal-sidebar {
    width: 280px;
    min-width: 280px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-profile {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-profile-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 159, 203, 0.25);
    border: 2px solid rgba(0, 159, 203, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 2rem;
    color: #fff;
}

.sidebar-profile h3 {
    color: #fff;
    font-size: 1.05rem;
    margin: 0 0 4px;
    font-weight: 600;
}

.sidebar-profile .profile-role {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.82rem;
    text-transform: capitalize;
}

.sidebar-property {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-property .prop-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.sidebar-property .prop-ref {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.78rem;
    margin-bottom: 6px;
}

.sidebar-property .prop-address {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82rem;
    line-height: 1.4;
}

/* Navigation */
.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.92rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(0, 159, 203, 0.15);
    color: #009FCB;
    border-left-color: #009FCB;
    font-weight: 600;
}

.sidebar-nav a .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 8px 20px;
}

/* Sidebar toggle for mobile */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 48px;
    left: 16px;
    z-index: 200;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #009FCB;
    color: #fff;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* ─── Main Content ───────────────────────────────────────── */
.portal-content {
    flex: 1;
    margin-left: 280px;
    padding: 30px 40px 60px;
    min-height: calc(100vh - 56px);
}

.portal-page-title {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0 0 24px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-page-title .title-icon {
    font-size: 1.4rem;
}

/* ─── Cards / Boxes ──────────────────────────────────────── */
.portal-card {
    background: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px;
    margin-bottom: 20px;
    color: #fff;
}

.portal-card h3 {
    font-size: 1.1rem;
    margin: 0 0 16px;
    font-weight: 600;
    color: #fff;
}

/* ─── Dashboard Cards Grid ───────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dash-stat {
    text-align: center;
    padding: 30px 24px;
}

.dash-stat .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #009FCB;
    margin-bottom: 6px;
}

.dash-stat .stat-label {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.88rem;
}

/* Manager info card */
.manager-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.manager-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 159, 203, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.manager-info h4 {
    margin: 0 0 4px;
    font-size: 1rem;
    color: #fff;
}

.manager-info p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.manager-info a {
    color: #009FCB;
    text-decoration: none;
}

.manager-info a:hover {
    text-decoration: underline;
}

/* ─── Tables ─────────────────────────────────────────────── */
.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.portal-table thead th {
    text-align: left;
    padding: 12px 14px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.portal-table tbody td {
    padding: 12px 14px;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.portal-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.portal-table .amount {
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.portal-table .amount.negative {
    color: #f87171;
}

.portal-table .amount.positive {
    color: #4ade80;
}

/* ─── Status badges ──────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-open {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-in_progress {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-closed {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.badge-upcoming {
    background: rgba(0, 159, 203, 0.2);
    color: #009FCB;
    border: 1px solid rgba(0, 159, 203, 0.3);
}

.badge-completed {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.badge-cancelled {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.3);
}

/* ─── Document Category Grid ─────────────────────────────── */
.doc-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.doc-cat-card {
    background: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
    text-decoration: none;
    color: #fff;
    transition: all 0.25s;
    cursor: pointer;
    display: block;
}

.doc-cat-card:hover {
    background: rgba(0, 159, 203, 0.12);
    border-color: rgba(0, 159, 203, 0.3);
    transform: translateY(-2px);
}

.doc-cat-card .cat-icon {
    font-size: 2.2rem;
    margin-bottom: 12px;
    display: block;
    color: #009FCB;
}

.doc-cat-card .cat-label {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.doc-cat-card .cat-updated {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
}

/* Document list within a category */
.doc-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.doc-list-item:last-child {
    border-bottom: none;
}

.doc-list-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.doc-list-info .doc-icon {
    font-size: 1.3rem;
    color: #009FCB;
    flex-shrink: 0;
}

.doc-list-info .doc-title {
    font-size: 0.9rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-list-info .doc-date {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}

.doc-download-btn {
    padding: 6px 14px;
    background: rgba(0, 159, 203, 0.2);
    color: #009FCB;
    border: 1px solid rgba(0, 159, 203, 0.3);
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.doc-download-btn:hover {
    background: rgba(0, 159, 203, 0.35);
}

/* ─── Request Thread ─────────────────────────────────────── */
.request-thread {
    margin-top: 20px;
}

.thread-message {
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 10px;
    border-left: 3px solid;
}

.thread-message.msg-client {
    background: rgba(0, 159, 203, 0.08);
    border-left-color: #009FCB;
}

.thread-message.msg-manager {
    background: rgba(74, 222, 128, 0.08);
    border-left-color: #4ade80;
}

.thread-message .msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.82rem;
}

.thread-message .msg-sender {
    font-weight: 600;
    color: #fff;
}

.thread-message .msg-date {
    color: rgba(255, 255, 255, 0.45);
}

.thread-message .msg-body {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    line-height: 1.6;
}

.thread-attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    color: #009FCB;
    font-size: 0.82rem;
    text-decoration: none;
}

.thread-attachment:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ─── Property Cards ─────────────────────────────────────── */
.property-card {
    margin-bottom: 20px;
}

.property-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.property-header h3 {
    margin: 0;
}

.property-header .prop-ref-badge {
    background: rgba(0, 159, 203, 0.15);
    color: #009FCB;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.lots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.lot-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 14px;
}

.lot-card .lot-number {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 8px;
    color: #009FCB;
}

.lot-card .lot-detail {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 3px;
}

/* ─── Forms ──────────────────────────────────────────────── */
.portal-form {
    max-width: 600px;
}

.portal-form .form-group {
    margin-bottom: 18px;
}

.portal-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.portal-form input[type="text"],
.portal-form input[type="email"],
.portal-form input[type="password"],
.portal-form select,
.portal-form textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.portal-form input:focus,
.portal-form select:focus,
.portal-form textarea:focus {
    outline: none;
    border-color: #009FCB;
    box-shadow: 0 0 0 2px rgba(0, 159, 203, 0.2);
}

.portal-form textarea {
    min-height: 120px;
    resize: vertical;
}

.portal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #009FCB;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.portal-btn:hover {
    background: #0087ad;
}

.portal-btn-outline {
    background: transparent;
    border: 1px solid rgba(0, 159, 203, 0.4);
    color: #009FCB;
}

.portal-btn-outline:hover {
    background: rgba(0, 159, 203, 0.1);
}

.portal-btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

/* ─── Login Page ─────────────────────────────────────────── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 40px 36px;
}

.login-box h1 {
    text-align: center;
    color: #fff;
    font-size: 1.5rem;
    margin: 0 0 6px;
}

.login-box .login-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.88rem;
    margin-bottom: 28px;
}

.login-box .login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 18px;
    text-align: center;
}

.login-box .form-group {
    margin-bottom: 18px;
}

.login-box label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.login-box input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.login-box input:focus {
    outline: none;
    border-color: #009FCB;
    box-shadow: 0 0 0 2px rgba(0, 159, 203, 0.2);
}

.login-box .login-submit {
    width: 100%;
    padding: 12px;
    background: #009FCB;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.2s;
}

.login-box .login-submit:hover {
    background: #0087ad;
}

.login-box .login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.45);
}

.login-box .login-footer a {
    color: #009FCB;
    text-decoration: none;
}

/* ─── Balance display ────────────────────────────────────── */
.balance-display {
    text-align: center;
    padding: 20px;
}

.balance-label {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.balance-amount {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
}

.balance-amount.positive {
    color: #4ade80;
}

.balance-amount.negative {
    color: #f87171;
}

/* ─── Section: recent operations ─────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
}

.section-header a {
    color: #009FCB;
    text-decoration: none;
    font-size: 0.85rem;
}

/* ─── Assembly cards ─────────────────────────────────────── */
.assembly-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.assembly-info h4 {
    margin: 0 0 6px;
    color: #fff;
    font-size: 1rem;
}

.assembly-info p {
    margin: 0 0 4px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.assembly-docs {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ─── Empty state ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.45);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
}

.empty-state p {
    font-size: 0.92rem;
    margin: 0;
}

/* ─── Back link ──────────────────────────────────────────── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #009FCB;
    text-decoration: none;
    font-size: 0.88rem;
    margin-bottom: 20px;
}

.back-link:hover {
    text-decoration: underline;
}

/* ─── Filters ────────────────────────────────────────────── */
.portal-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.portal-filters select {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .portal-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .portal-sidebar.open {
        transform: translateX(0);
    }

    .portal-content {
        margin-left: 0;
        padding: 20px 16px 60px;
    }

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

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

    .doc-categories {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .portal-table {
        font-size: 0.8rem;
    }

    .portal-table thead th,
    .portal-table tbody td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 28px 20px;
    }

    .doc-categories {
        grid-template-columns: 1fr 1fr;
    }

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