/* =============================================================================
   Portal Page Styles - Æj Æj Legal
   ============================================================================= */

/* Brand Green variables - used for Audkenni login button */
:root {
    --brand-green: #5B7F5F;
    --brand-green-dark: #4A6A4E;
    --brand-green-light: #7A9E7E;
    --brand-green-bg: rgba(91, 127, 95, 0.1);
}

/* Portal Body */
.portal-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8faf9 0%, #e8f0ed 100%);
}

/* Portal Sections */
.portal-section {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Full height login section (no navbar) */
.portal-section-full {
    min-height: 100vh;
}

/* Login Card */
.portal-login-card {
    background: white;
    border-radius: 24px;
    padding: 3rem 2.5rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

/* Portal Brand (inside login card) */
.portal-brand {
    margin-bottom: 1.5rem;
}

.portal-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.portal-brand-link:hover {
    opacity: 0.8;
}

.portal-brand-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    font-style: italic;
    color: var(--brand-green);
}

.portal-brand-icon {
    flex-shrink: 0;
}

.portal-logo {
    margin-bottom: 1.5rem;
}

.portal-login-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.portal-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Audkenni Button */
.btn-audkenni {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--brand-green);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-audkenni:hover {
    background: var(--brand-green-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 128, 0, 0.2);
}

.btn-audkenni:active {
    transform: translateY(0);
}

.btn-audkenni svg {
    flex-shrink: 0;
}

.portal-disclaimer {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.portal-disclaimer small {
    opacity: 0.8;
}

/* Login Divider */
.login-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

.login-divider span {
    padding: 0 0.75rem;
}

/* Password Login Toggle Button */
.btn-toggle-password {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-toggle-password:hover {
    background: var(--bg-soft);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.btn-toggle-password .toggle-arrow {
    transition: transform 0.2s ease;
}

.btn-toggle-password.active .toggle-arrow {
    transform: rotate(180deg);
}

/* Password Login Form */
.password-login-form {
    margin-top: 1rem;
    padding: 1.25rem;
    background: var(--bg-soft);
    border-radius: 12px;
    text-align: left;
}

.password-login-form.hidden {
    display: none;
}

.password-login-form .form-group {
    margin-bottom: 1rem;
}

.password-login-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.password-login-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.password-login-form input:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(91, 127, 95, 0.15);
}

.password-login-form input::placeholder {
    color: var(--text-muted);
}

.password-login-form .form-error {
    padding: 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.password-login-form .form-error.hidden {
    display: none;
}

.btn-password-login {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.btn-password-login .btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-password-login .btn-spinner.hidden {
    display: none;
}

.btn-password-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading Card */
.portal-loading-card {
    background: white;
    border-radius: 24px;
    padding: 3rem 2.5rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.portal-loading-card h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.portal-loading-card p {
    color: var(--text-secondary);
}

/* Dashboard State */
#dashboardState .container {
    max-width: 900px;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

#dashboardState.portal-section {
    align-items: flex-start;
    padding-top: 6rem;
}

/* Portal Header */
.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 52px;
    height: 52px;
    background: var(--bg-soft);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-green);
}

.user-details h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.user-kennitala {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-family: 'SF Mono', Monaco, monospace;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-logout:hover {
    background: var(--bg-soft);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

/* Section Title */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Empty State */
.empty-state {
    background: white;
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-state h4 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Cases Grid */
.cases-grid {
    display: grid;
    gap: 1rem;
}

/* Case Card */
.case-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.case-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--brand-green-light);
}

.case-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.case-number {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--brand-green);
    background: var(--brand-green-bg);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
}

.case-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
}

.case-status.status-draft {
    background: #f3f4f6;
    color: #6b7280;
}

.case-status.status-submitted {
    background: #dbeafe;
    color: #1d4ed8;
}

.case-status.status-in_review {
    background: #fef3c7;
    color: #d97706;
}

.case-status.status-active {
    background: var(--brand-green-bg);
    color: var(--brand-green);
}

.case-status.status-completed {
    background: #d1fae5;
    color: #059669;
}

.case-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.case-type {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.case-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

.case-meta {
    display: flex;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.case-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.case-meta-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-soft);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: var(--bg-medium);
    color: var(--text-primary);
}

/* Modal Case Detail */
.modal-case-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.modal-case-number {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 1.1rem;
    color: var(--brand-green);
    margin-bottom: 0.5rem;
}

.modal-case-type {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.modal-section-content {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.modal-estimate {
    background: var(--brand-green-bg);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.modal-estimate-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.modal-estimate-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-green);
}

/* Status Timeline in Modal */
.status-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-step-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-step.completed .status-step-icon {
    background: var(--brand-green);
    color: white;
}

.status-step.current .status-step-icon {
    background: #dbeafe;
    color: #1d4ed8;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.status-step.pending .status-step-icon {
    background: var(--bg-soft);
    color: var(--text-muted);
}

.status-step-text {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.status-step.pending .status-step-text {
    color: var(--text-muted);
}

/* Dev Mode Banner */
.dev-mode-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fef3c7;
    color: #92400e;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 100;
}

.dev-mode-banner.hidden {
    display: none;
}

/* Modal Large */
.modal-large {
    max-width: 700px;
}

/* Document Upload Section */
.modal-documents {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.modal-documents h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.documents-list {
    margin-bottom: 1rem;
}

.documents-list .empty-docs {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-soft);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.document-item svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-download {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--brand-green);
    background: var(--brand-green-bg);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-download:hover {
    background: var(--brand-green);
    color: white;
}

/* Upload Area */
.upload-dropzone {
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--brand-green);
    background: var(--brand-green-bg);
}

.upload-dropzone svg {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.upload-dropzone p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.btn-browse {
    background: none;
    border: none;
    color: var(--brand-green);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Upload Progress */
.upload-progress {
    margin-top: 1rem;
}

.upload-progress.hidden {
    display: none;
}

.progress-bar {
    height: 6px;
    background: var(--bg-soft);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--brand-green);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .portal-login-card {
        padding: 2rem 1.5rem;
    }

    .portal-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .user-info {
        flex-direction: column;
    }

    .case-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 0.5rem;
    }

    .upload-dropzone {
        padding: 1.5rem;
    }
}

/* =============================================================================
   Impersonation Banner Styles
   ============================================================================= */

.impersonation-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    color: white;
    padding: 0.75rem 1rem;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.impersonation-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.impersonation-content svg {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.impersonation-content span {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-exit-impersonation {
    background: white;
    color: #FF8C00;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-exit-impersonation:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.btn-exit-impersonation:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
