/* ===========================================
   PORTAL STYLES — Customer Portal
   =========================================== */

:root {
    --portal-primary: #1a1d23;
    --portal-accent: #2563eb;
}

/* Portal Auth Layout */
.portal-auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--portal-primary) 0%, #2d3748 100%);
    padding: 24px;
}

.portal-auth-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Portal Login */
.portal-login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.portal-login-logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--portal-primary);
    margin: 8px 0 0 0;
}

.portal-login-subtitle {
    color: #5f6578;
    font-size: 0.9rem;
    margin-top: 4px;
}

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

.portal-info-message {
    background: #eff6ff;
    color: #1e40af;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 16px;
    border: 1px solid #bfdbfe;
}

.portal-success-message {
    text-align: center;
    padding: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #166534;
}

.portal-success-message .strong {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 8px;
    display: block;
}

/* Portal Layout */
.portal-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8f9fb;
}

.portal-nav {
    background: var(--portal-primary);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.portal-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.portal-nav-logo {
    height: 28px;
}

.portal-nav-company {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
}

.portal-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
}

.portal-nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.portal-nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.portal-nav-link.active {
    color: white;
    background: var(--portal-accent);
}

.portal-nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: auto;
}

.portal-nav-username {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
}

.portal-nav-logout {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: all 0.15s ease;
}

.portal-nav-logout:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

/* Portal Content */
.portal-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
}

.portal-footer {
    text-align: center;
    padding: 16px 24px;
    color: #8b90a0;
    font-size: 0.8rem;
    border-top: 1px solid #e2e4ea;
    background: white;
}

/* Portal Cards */
.portal-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e4ea;
    padding: 20px;
    margin-bottom: 16px;
}

.portal-card-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1a1d23;
    margin-bottom: 16px;
}

/* Portal Dashboard */
.portal-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.portal-metric {
    background: white;
    border: 1px solid #e2e4ea;
    border-radius: 10px;
    padding: 16px 20px;
    text-align: center;
}

.portal-metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--portal-primary);
    line-height: 1.2;
}

.portal-metric-label {
    font-size: 0.8rem;
    color: #5f6578;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Portal Tables */
.portal-table {
    width: 100%;
    border-collapse: collapse;
}

.portal-table thead th {
    text-align: left;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #5f6578;
    border-bottom: 2px solid #e2e4ea;
}

.portal-table tbody td {
    padding: 10px 12px;
    font-size: 0.875rem;
    border-bottom: 1px solid #eff0f3;
    color: #1a1d23;
}

.portal-table tbody tr:hover {
    background: #f9fafb;
}

.portal-table .mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
}

/* Portal Messages */
.portal-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.portal-message-bubble.from-portal {
    align-self: flex-end;
    background: var(--portal-accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.portal-message-bubble.from-admin {
    align-self: flex-start;
    background: #f1f3f5;
    color: #1a1d23;
    border-bottom-left-radius: 4px;
}

.portal-message-meta {
    font-size: 0.75rem;
    margin-top: 4px;
    opacity: 0.7;
}

/* Portal Welcome */
.portal-welcome {
    background: linear-gradient(135deg, var(--portal-primary) 0%, #2d3748 100%);
    color: white;
    border-radius: 12px;
    padding: 24px 32px;
    margin-bottom: 24px;
}

.portal-welcome h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.portal-welcome p {
    opacity: 0.85;
    font-size: 0.95rem;
}

/* Portal Status Tags */
.portal-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.portal-tag-blue { background: #eff6ff; color: #1e40af; }
.portal-tag-green { background: #f0fdf4; color: #166534; }
.portal-tag-orange { background: #fff7ed; color: #9a3412; }
.portal-tag-red { background: #fef2f2; color: #991b1b; }
.portal-tag-grey { background: #f3f4f6; color: #4b5563; }

/* Portal Form */
.portal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.portal-form .form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 4px;
    display: block;
}

.portal-form .form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.portal-form .form-input:focus {
    outline: none;
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.portal-form .btn-portal {
    padding: 10px 24px;
    background: var(--portal-accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.portal-form .btn-portal:hover {
    opacity: 0.9;
}

.portal-form .btn-portal:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .portal-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 8px;
    }

    .portal-nav-links {
        order: 3;
        width: 100%;
        padding-bottom: 4px;
    }

    .portal-nav-user {
        margin-left: auto;
    }

    .portal-content {
        padding: 16px;
    }

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

    .portal-message-bubble {
        max-width: 90%;
    }
}

/* Print styles */
@media print {
    .portal-nav,
    .portal-footer,
    .portal-nav-logout {
        display: none !important;
    }

    .portal-content {
        max-width: 100%;
        padding: 0;
    }
}
