/*
 * Global styles for the LLT Legal & Tax Services portal.
 *
 * This stylesheet defines CSS custom properties for colours and
 * dimensions, resets common element margins and paddings, and
 * establishes responsive layouts used throughout both the admin
 * dashboard and client portal.  The goal is to provide a
 * consistent visual foundation upon which subsequent pages can
 * build without repeating boilerplate styles.
 */

/* Colour palette variables.  Feel free to adjust these values to
 * match your firm's branding.  Colours are chosen with
 * accessibility in mind—ensure sufficient contrast when
 * modifying them.  The dark mode overrides can be applied by
 * toggling the `dark-mode` class on the body element. */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --info-color: #17a2b8;
    --bg-light: #f8f9fa;
    --bg-dark: #1d1f21;
    --text-color: #2c3e50;
    --text-color-inverse: #ffffff;
    --border-radius: 6px;
    --box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.2s;
}

body.dark-mode {
    --bg-light: #1d1f21;
    --bg-dark: #2c3e50;
    --text-color: #ffffff;
    --text-color-inverse: #2c3e50;
}

/* Base element resets */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-light);
    color: var(--text-color);
    transition: background var(--transition-speed), color var(--transition-speed);
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.5em;
    font-weight: 600;
}

p {
    margin-top: 0;
    margin-bottom: 1em;
    line-height: 1.5;
}

/* Utility classes */
.llt-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.llt-card {
    background: var(--bg-light);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1rem;
    margin-bottom: 1rem;
    transition: background var(--transition-speed);
}

body.dark-mode .llt-card {
    background: var(--secondary-color);
}

.llt-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: var(--border-radius);
    color: var(--text-color-inverse);
}

/* Status badge modifiers */
.status-badge--pending {
    background: var(--warning-color);
}
.status-badge--approved {
    background: var(--success-color);
}
.status-badge--rejected {
    background: var(--error-color);
}

/* Grid layout for client portal and admin pages */
.llt-client-portal {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar content";
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
    transition: grid-template-columns var(--transition-speed);
}

.llt-client-portal--collapsed {
    grid-template-columns: 60px 1fr;
}

.llt-client-portal > .portal-header {
    grid-area: header;
    background: var(--secondary-color);
    color: var(--text-color-inverse);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Generic portal header styles (outside of the CSS grid context).
 * When the header is not a direct child of .llt-client-portal,
 * these rules ensure it still appears styled correctly. */
.portal-header {
    background: var(--secondary-color);
    color: var(--text-color-inverse);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.portal-header .left,
.portal-header .center,
.portal-header .right {
    display: flex;
    align-items: center;
}
.portal-header .portal-logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color-inverse);
    text-decoration: none;
    margin-right: 1rem;
}
.portal-header .sidebar-toggle,
.portal-header .portal-notifications,
.portal-header .user-avatar,
.portal-header .theme-toggle {
    background: none;
    border: none;
    color: var(--text-color-inverse);
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 0.5rem;
}
.portal-header .portal-search input[type="search"] {
    padding: 0.35rem 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.15);
    min-width: 200px;
}
.portal-header .user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-light);
    color: var(--text-color);
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    min-width: 150px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    z-index: 1000;
}
.portal-header .portal-user:hover .user-dropdown {
    display: block;
}
.portal-header .user-dropdown li a {
    display: block;
    padding: 0.5rem 1rem;
    color: inherit;
    text-decoration: none;
}
.portal-header .user-dropdown li a:hover {
    background: var(--bg-dark);
    color: var(--text-color-inverse);
}

/* Sidebar navigation */
.portal-sidebar {
    background: var(--secondary-color);
    color: var(--text-color-inverse);
    min-height: 100%;
}

.portal-sidebar .sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.portal-sidebar .sidebar-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-color-inverse);
    text-decoration: none;
    transition: background var(--transition-speed), color var(--transition-speed);
}
.portal-sidebar .sidebar-item a i {
    margin-right: 0.75rem;
    width: 1rem;
    text-align: center;
}
.portal-sidebar .sidebar-item.active a,
.portal-sidebar .sidebar-item a:hover {
    background: var(--primary-color);
    color: var(--text-color-inverse);
}

/* Hide sidebar labels when sidebar is collapsed on large screens */
body.sidebar-collapsed .portal-sidebar .label {
    display: none;
}

.llt-client-portal > .portal-sidebar {
    grid-area: sidebar;
    background: var(--secondary-color);
    color: var(--text-color-inverse);
    padding: 1rem 0;
    transition: width var(--transition-speed);
}

.llt-client-portal > .portal-content {
    grid-area: content;
    padding: 1rem;
}

@media (max-width: 768px) {
    .llt-client-portal {
        grid-template-areas:
            "header"
            "content";
        grid-template-columns: 1fr;
    }
    .llt-client-portal > .portal-sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        height: 100%;
        width: 250px;
        overflow-y: auto;
        background: var(--secondary-color);
        z-index: 999;
        transition: left var(--transition-speed);
    }
    body.sidebar-open .llt-client-portal > .portal-sidebar {
        left: 0;
    }
}

/* Tables */
.llt-table {
    width: 100%;
    border-collapse: collapse;
}
.llt-table th,
.llt-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.llt-table thead th {
    background: var(--bg-dark);
    color: var(--text-color-inverse);
}

/* Quick actions bar */
.quick-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.quick-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-color-inverse);
    background: var(--primary-color);
    transition: opacity var(--transition-speed);
}
.quick-actions button:hover {
    opacity: 0.9;
}

/* KPI tiles */
.kpi-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.kpi-tile {
    background: var(--bg-light);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1rem;
    text-align: center;
}
body.dark-mode .kpi-tile {
    background: var(--secondary-color);
}

/* Notifications badge */
.notification-badge {
    display: inline-block;
    min-width: 1.5rem;
    padding: 0.25rem;
    border-radius: 50%;
    font-size: 0.75rem;
    background: var(--error-color);
    color: var(--text-color-inverse);
    text-align: center;
}

/* Progress bar used in services and checklists */
.progress-bar {
    width: 100%;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    overflow: hidden;
    height: 8px;
    margin-bottom: 0.5rem;
}
.progress-bar-inner {
    height: 100%;
    background: var(--primary-color);
    width: 0;
    transition: width var(--transition-speed);
}

/* Timeline styling for service detail */
.timeline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0;
    position: relative;
}
.timeline-step {
    flex: 1;
    text-align: center;
    position: relative;
}
.timeline-step .dot {
    width: 14px;
    height: 14px;
    background: var(--bg-dark);
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}
.timeline-step .label {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}
.timeline-step.completed .dot {
    background: var(--success-color);
}
.timeline::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.15);
    z-index: 1;
}
.timeline-step.completed ~ .timeline-step .dot {
    background: var(--bg-dark);
}

/* Filter bar for services and documents */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.filter-bar .tab {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    background: var(--bg-dark);
    color: var(--text-color-inverse);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background var(--transition-speed);
}
.filter-bar .tab.active {
    background: var(--primary-color);
}
.filter-bar .service-search input[type="search"],
.filter-bar .service-search input[type=search],
.filter-bar .service-search input[type="text"] {
    padding: 0.35rem 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex: 1;
    min-width: 200px;
}

/* Service card styling */
.service-card {
    margin-bottom: 1rem;
}
.service-card .status-badge--pending,
.service-card .status-badge--initiated,
.service-card .status-badge--in_progress,
.service-card .status-badge--documents_submitted,
.service-card .status-badge--under_review {
    background: var(--warning-color);
    color: var(--text-color-inverse);
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
}
.service-card .status-badge--completed {
    background: var(--success-color);
    color: var(--text-color-inverse);
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
}

/* Messages layout */
.messages-thread {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}
.message-item {
    margin-bottom: 0.75rem;
}
.message-item.client .bubble {
    background: var(--primary-color);
    color: var(--text-color-inverse);
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    max-width: 80%;
    word-wrap: break-word;
    align-self: flex-end;
}
.message-item.admin .bubble {
    background: var(--secondary-color);
    color: var(--text-color-inverse);
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    max-width: 80%;
    word-wrap: break-word;
}
.message-item .meta {
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
    color: var(--secondary-color);
}

/* Checklist statuses */
.checklist-status {
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    color: var(--text-color-inverse);
}
.checklist-status.missing {
    background: var(--warning-color);
}
.checklist-status.uploaded {
    background: var(--info-color);
}
.checklist-status.approved {
    background: var(--success-color);
}

/* Payment options list */
.payment-options {
    list-style: none;
    padding: 0;
    margin: 0;
}
.payment-options li {
    margin-bottom: 0.25rem;
}