/* Tabs */
/* Legacy tab-btn (deprecated, use tabs-pills instead) */
.tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--color-bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--bg-surface-hover);
}

.tab-btn.active {
    background: var(--primary-color);
    color: var(--color-text-inverse);
    border-color: var(--primary-color);
}

/* Underline Tabs - For content switching (e.g. task-detail tabs) */
.tabs-underline {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-underline {
    padding: 0.75rem 0.25rem;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab-underline:hover {
    color: var(--text-main);
}

.tab-underline.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* Pill Tabs - For filters (e.g. dashboard filters) */
.tabs-pills {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: var(--spacing-md);
    -webkit-overflow-scrolling: touch;
}

.tab-pill {
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tab-pill:hover {
    background: var(--bg-surface-hover);
}

.tab-pill.active {
    background: var(--primary-color);
    color: var(--color-text-inverse);
    border-color: var(--primary-color);
}

/* Tab Content */
.tab-content {
    display: none;
}

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

/* Project Tabs - Icon-based navigation for project detail */
.project-tabs-nav {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    background: var(--color-bg-surface-alt);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.project-tabs-nav::-webkit-scrollbar {
    display: none;
}

.project-tab-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.625rem 0.875rem;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 56px;
}

.project-tab-item:active {
    transform: scale(0.95);
}

.project-tab-item .tab-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.project-tab-item .tab-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.project-tab-item.active {
    background: var(--primary-color);
}

.project-tab-item.active .tab-label {
    color: var(--color-text-inverse);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--color-text-inverse);
}

.btn-primary:active {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--btn-secondary-bg);
    border: 1px solid var(--btn-secondary-border);
    color: var(--btn-secondary-text);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:active {
    background-color: rgba(37, 99, 235, 0.1);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-lg {
    padding: var(--spacing-md);
    font-size: var(--font-size-lg);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.btn-text {
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    padding: var(--spacing-sm);
}

.btn-text:hover {
    background-color: var(--bg-body);
    color: var(--text-main);
}

/* Floating Action Button (FAB) */
.btn-fab {
    position: fixed;
    bottom: calc(60px + var(--safe-area-inset-bottom) + 20px); /* 60px navbar + 20px margin */
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--color-text-inverse);
    font-size: 1.5rem;
    border: none;
    box-shadow: var(--shadow-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 40;
}

.btn-fab:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.btn-fab:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
    transform: scale(1.05);
}

/* Button Group - For grouped toggle buttons */
.btn-group {
    display: inline-flex;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.btn-group .btn {
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border-color);
    margin: 0;
}

.btn-group .btn:last-child {
    border-right: none;
}

.btn-group .btn.active {
    background-color: var(--primary-color);
    color: var(--color-text-inverse);
}

.btn-group .btn:not(.active) {
    background-color: var(--color-bg-surface);
    color: var(--text-secondary);
}

.btn-group .btn:not(.active):hover {
    background-color: var(--bg-surface-hover);
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

.loading-spinner.sm {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

.loading-spinner.lg {
    width: 56px;
    height: 56px;
    border-width: 5px;
}

@keyframes spinner-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Cards */
.card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border-color);
}

/* Clickable cards with hover effect */
.card.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.card.clickable:hover {
    background-color: var(--bg-surface-variant);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card.clickable:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--text-main);
    font-weight: 500;
}

.text-muted {
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    transition: border-color 0.2s;
}

/* Input with action button (copy, call, etc.) */
.input-with-action {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.input-with-action .form-input {
    flex: 1;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-action:hover {
    background: var(--bg-body);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-action.btn-call {
    background: var(--color-success);
    border-color: var(--color-success);
    color: var(--color-white);
}

.btn-action.btn-call:hover {
    background: var(--color-emerald-600);
    border-color: var(--color-emerald-600);
}

.form-select, .form-textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    transition: border-color 0.2s;
    font-family: inherit;
    font-size: inherit;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary-color);
}

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

/* Status Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background-color: var(--badge-success-bg); color: var(--badge-success-fg); }
.badge-warning { background-color: var(--badge-warning-bg); color: var(--badge-warning-fg); }
.badge-error   { background-color: var(--badge-error-bg); color: var(--badge-error-fg); }
.badge-info    { background-color: var(--badge-info-bg); color: var(--badge-info-fg); }
.badge-neutral { background-color: var(--badge-neutral-bg); color: var(--badge-neutral-fg); }
.badge-secondary { background-color: var(--color-gray-200); color: var(--color-gray-700); }
.badge-danger { background-color: var(--badge-error-bg); color: var(--badge-error-fg); }

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background-color: var(--toast-default-bg);
    color: var(--color-text-inverse);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow-md);
    animation: slideDown 0.3s ease-out;
    pointer-events: auto;
}

.toast-success {
    background-color: var(--toast-success-bg);
}

.toast-error {
    background-color: var(--toast-error-bg);
}

.toast-warning {
    background-color: var(--toast-warning-bg);
}

.toast-info {
    background-color: var(--toast-info-bg);
}

.toast-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

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

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

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--spinner-track-color, rgba(255, 255, 255, 0.3));
    border-top-color: var(--spinner-color, var(--color-white));
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s ease-out;
}

.modal-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: var(--bg-main);
}

.modal-body {
    padding: var(--spacing-md);
}

.modal-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Form Error Styles */
.form-error {
    color: var(--color-error);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-xs);
}

.form-error-box {
    background-color: var(--color-error-bg);
    border: 1px solid var(--color-red-300);
    color: var(--color-error-fg);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
}

.form-input-error {
    border-color: var(--color-error) !important;
    background-color: var(--color-red-50);
}

.form-input-error:focus {
    border-color: var(--color-red-600) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1) !important;
}

/* Image Preview */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

.image-preview-backdrop {
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.2s ease-out;
}

.image-preview-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.image-preview-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: var(--image-preview-close-bg, rgba(255, 255, 255, 0.2));
    color: var(--color-white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.image-preview-close:hover {
    background-color: var(--image-preview-close-hover-bg, rgba(255, 255, 255, 0.3));
}

.message-image {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
}

/* Filter Tabs */
.filter-tabs {
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 0.5rem 1rem;
    background-color: var(--color-bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover {
    background-color: var(--bg-surface-hover);
}

.filter-tab.active {
    background-color: var(--primary-color);
    color: var(--color-text-inverse);
    border-color: var(--primary-color);
}

/* Notification Styles */
.notification-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.notification-read {
    opacity: 0.75;
    background-color: var(--color-bg-surface-alt);
}

.notification-unread {
    border-left: 4px solid var(--primary-color);
}

.notification-type-icon {
    font-size: 1.25rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Styles */
.message-image {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

/* Shake Animation for Errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s;
}

/* ============ Project Group Styles ============ */

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    background-color: var(--bg-main);
    padding: 0.25rem;
    border-radius: var(--radius-md);
}

.view-toggle-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    background-color: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.view-toggle-btn:hover {
    background-color: var(--color-primary-bg);
    color: var(--primary-color);
}

.view-toggle-btn.active {
    background-color: var(--primary-color);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-sm);
}

/* Group Stats Grid */
.group-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

/* Contractor Card */
.contractor-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.contractor-card h4 {
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

/* Teams List */
.teams-list {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.team-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border-light);
}

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

/* Teams Grid (for all teams view) */
.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.team-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.team-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.team-card h5 {
    color: var(--text-main);
    margin: 0;
}

/* Responsive adjustments for mobile */
@media (max-width: 640px) {
    .teams-grid {
        grid-template-columns: 1fr;
    }

    .group-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .view-toggle {
        flex-direction: row;
    }

    .view-toggle-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
}

/* ============ Quote Comparison and Project Alias System Styles ============ */

/* Invitation Badge */
.invitation-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-error);
    color: var(--color-text-inverse);
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Invitation Notification */
.invitation-notification {
    transition: all 0.3s ease;
}

.invitation-notification:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.2);
}

/* Quote Comparison Section */
.quote-comparison-section {
    animation: fadeInUp 0.4s ease-out;
}

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

/* Comparison Table */
.comparison-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.comparison-table table {
    border-collapse: collapse;
    width: 100%;
    min-width: 600px;
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.comparison-table th {
    background-color: var(--bg-surface-variant);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.comparison-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.comparison-table tr:hover td {
    background-color: var(--bg-surface-variant);
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

/* Quote Highlight */
.quote-highlight {
    background-color: rgba(34, 197, 94, 0.1) !important;
    font-weight: 600;
    position: relative;
}

.quote-highlight::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--success-color);
}

/* Project Alias */
.project-alias {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background-color: var(--bg-surface-variant);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

.project-alias-edit {
    cursor: pointer;
    transition: all 0.2s;
}

.project-alias-edit:hover {
    background-color: var(--primary-color);
    color: var(--color-text-inverse);
}

/* Project Tags */
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.project-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background-color: var(--role-owner-color);
    color: var(--color-text-inverse);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.project-tag-remove {
    margin-left: 0.25rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.project-tag-remove:hover {
    opacity: 1;
}

/* Related Projects Group */
.related-projects-group {
    transition: all 0.3s ease;
    cursor: default;
}

.related-projects-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Quote Detail Expand Animation */
.quote-detail-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.quote-detail-expand.expanded {
    max-height: 500px;
}

/* Invitation Card */
.invitation-card {
    transition: all 0.3s ease;
}

.invitation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Form Input Small */
.form-input-sm {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

/* Grid 2 columns */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .comparison-table th,
    .comparison-table td {
        padding: 8px;
        font-size: 0.875rem;
    }

    .project-alias {
        font-size: 0.75rem;
    }

    .project-tag {
        font-size: 0.625rem;
    }

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

/* ============ Chat Room Responsive Styles ============ */

/* Chat Room Container */
.chat-room {
    display: flex;
    flex-direction: column;
    height: 100vh; /* iOS will handle viewport adjustment */
    background: var(--chat-room-bg);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 1001; /* Higher than bottom-nav (1000) to cover it */
    transition: height 0.3s ease; /* Smooth transition when keyboard appears */
}

/* Chat Header */
.chat-header {
    background: var(--chat-header-bg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-primary);
}

.chat-header-btn {
    background: var(--chat-header-btn-bg, rgba(255, 255, 255, 0.15));
    border: none;
    color: var(--color-white);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-header-btn:hover {
    background: var(--chat-header-btn-hover-bg, rgba(255, 255, 255, 0.25));
}

.chat-header-info {
    text-align: center;
    flex: 1;
    padding: 0 0.75rem;
    min-width: 0;
}

.chat-header-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 2px;
}

.chat-online-dot {
    width: 8px;
    height: 8px;
    background: var(--color-success);
    border-radius: 50%;
    animation: pulse-online 2s infinite;
    flex-shrink: 0;
}

.chat-status-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
}

@keyframes pulse-online {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 1.25rem;
    padding-bottom: calc(80px + env(safe-area-inset-bottom)); /* Reserve space for input area */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 0.5rem;
    max-width: 100%;
}

.chat-message-me {
    flex-direction: row-reverse;
}

.chat-message-other {
    gap: 0.625rem;
    align-items: flex-end;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--color-white);
    flex-shrink: 0;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.chat-bubble-wrapper {
    max-width: 78%;
    min-width: 0;
}

.chat-bubble {
    padding: 0.875rem 1rem;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 0.9375rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-bubble-me {
    background: var(--chat-bubble-me-bg);
    color: var(--color-white);
    border-radius: 18px 18px 4px 18px;
    box-shadow: var(--shadow-primary);
}

.chat-bubble-other {
    background: var(--chat-bubble-other-bg);
    color: var(--color-text-primary);
    border-radius: 18px 18px 18px 4px;
    box-shadow: var(--shadow-sm);
}

.chat-sender-name {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.chat-time {
    font-size: 0.6875rem;
    color: var(--color-text-tertiary);
    margin-top: 0.375rem;
}

.chat-time-me {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.375rem;
}

.chat-read-status {
    font-size: 0.6875rem;
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-read-status.read {
    color: var(--color-primary);
}

.chat-read-status.unread {
    color: var(--color-text-tertiary);
}

/* Date/System Messages */
.chat-date-divider {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
}

.chat-date-badge {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    background: var(--chat-date-badge-bg);
    padding: 0.375rem 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
}

.chat-system-badge {
    font-size: 0.75rem;
    color: var(--color-primary);
    background: var(--chat-system-badge-bg);
    padding: 0.375rem 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
}

/* Chat Input Area */
.chat-input-area {
    background: var(--color-bg-surface);
    padding: 1rem 1.25rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-shrink: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: var(--shadow-chat-input);
    border-top: 1px solid var(--color-border-light);
    transition: transform 0.3s ease-out;
}

.chat-attach-btn {
    background: var(--chat-attach-btn-bg);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-attach-btn:hover {
    transform: scale(1.05);
}

.chat-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--color-border);
    border-radius: 24px;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
    background: var(--chat-input-bg);
    color: var(--color-text-primary);
    min-width: 0;
}

.chat-input:focus {
    border-color: var(--color-primary);
    background: var(--color-bg-surface);
    box-shadow: 0 0 0 4px var(--color-focus-ring);
}

.chat-send-btn {
    background: var(--chat-send-btn-bg);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: var(--color-text-inverse);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: var(--shadow-primary);
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
}

/* Chat Responsive - Tablet */
@media (max-width: 768px) {
    .chat-header {
        padding: 0.875rem 1rem;
    }

    .chat-header-name {
        font-size: 1rem;
    }

    .chat-messages {
        padding: 1rem;
    }

    .chat-bubble-wrapper {
        max-width: 82%;
    }

    .chat-input-area {
        padding: 0.875rem 1rem;
        gap: 0.5rem;
    }
}

/* Chat Responsive - Mobile */
@media (max-width: 480px) {
    .chat-header {
        padding: 0.75rem 0.875rem;
    }

    .chat-header-btn {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 1.1rem;
    }

    .chat-header-info {
        padding: 0 0.5rem;
    }

    .chat-header-name {
        font-size: 0.9375rem;
    }

    .chat-status-text {
        font-size: 0.6875rem;
    }

    .chat-messages {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .chat-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .chat-bubble-wrapper {
        max-width: 85%;
    }

    .chat-bubble {
        padding: 0.75rem 0.875rem;
        font-size: 0.875rem;
        border-radius: 16px;
    }

    .chat-bubble-me {
        border-radius: 16px 16px 4px 16px;
    }

    .chat-bubble-other {
        border-radius: 16px 16px 16px 4px;
    }

    .chat-sender-name {
        font-size: 0.6875rem;
    }

    .chat-time {
        font-size: 0.625rem;
    }

    .chat-input-area {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .chat-attach-btn {
        width: 40px;
        height: 40px;
        font-size: 1.125rem;
    }

    .chat-input {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
        border-radius: 20px;
    }

    .chat-send-btn {
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
    }
}

/* Chat Responsive - Extra Small */
@media (max-width: 360px) {
    .chat-header {
        padding: 0.625rem 0.75rem;
    }

    .chat-header-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .chat-header-name {
        font-size: 0.875rem;
    }

    .chat-online-dot {
        width: 6px;
        height: 6px;
    }

    .chat-status-text {
        font-size: 0.625rem;
    }

    .chat-messages {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .chat-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.6875rem;
    }

    .chat-bubble-wrapper {
        max-width: 88%;
    }

    .chat-bubble {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
    }

    .chat-input-area {
        padding: 0.625rem;
        gap: 0.375rem;
    }

    .chat-attach-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .chat-input {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
        border-radius: 18px;
    }

    .chat-send-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ============================================
   MESSAGE CONTEXT MENU (Long Press)
   ============================================ */

/* Backdrop overlay with blur effect */
.message-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 9998;
    animation: fadeIn 0.2s ease;
}

/* Context menu container */
.message-context-menu {
    position: fixed;
    background: var(--color-bg-surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    min-width: 200px;
    z-index: 9999;
    animation: scaleIn 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-origin: center;
}

/* Menu item */
.message-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.9375rem;
    border: none;
    width: 100%;
    background: transparent;
    text-align: left;
    color: var(--color-text-primary);
}

.message-menu-item:hover {
    background: var(--color-bg-surface-hover);
}

.message-menu-item:active {
    background: var(--color-bg-surface-alt);
}

.message-menu-item.danger {
    color: var(--color-error);
}

.message-menu-item.danger:hover {
    background: var(--color-error-bg);
}

/* Menu icon */
.message-menu-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* Message highlight effect when long-pressed */
.chat-message.highlight {
    transform: scale(1.02);
    transition: transform 0.15s ease;
}

/* Skill Tags (Hashtag style) */
.skill-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--skill-tag-bg);
    color: var(--primary-color);
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.75rem;
    border: 1px solid var(--skill-tag-border);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.skill-tag:hover {
    background: var(--skill-tag-hover-bg);
    border-color: var(--skill-tag-hover-border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-xs);
}


/* Editable skill tags (with remove button) */
.skill-tag-editable {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 10px;
    background: var(--skill-tag-editable-bg);
    color: var(--primary-color);
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.75rem;
    border: 1px solid var(--skill-tag-editable-border);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.skill-tag-editable:hover {
    background: var(--skill-tag-editable-hover-bg);
    border-color: var(--skill-tag-editable-hover-border);
}

.skill-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-error-bg);
    color: var(--color-error);
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s ease;
    padding: 0;
}

.skill-tag-remove:hover {
    background: var(--color-red-200);
    color: var(--color-red-700);
    transform: scale(1.1);
}

.skill-tag-remove:active {
    transform: scale(0.95);
}


/* ============================================
   INLINE STYLE MIGRATION HELPERS
   用於取代 JS 內嵌樣式的輔助類別
   支援深色模式主題切換
   ============================================ */

/* === Chat Bubbles (Inline Replacement) === */
.chat-bubble-inline-me {
    background: var(--chat-bubble-me-bg);
    color: var(--color-white);
    padding: 0.625rem 0.875rem;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    word-break: break-word;
}

.chat-bubble-inline-other {
    background: var(--chat-bubble-other-bg);
    color: var(--color-text-primary);
    padding: 0.625rem 0.875rem;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    word-break: break-word;
    box-shadow: var(--shadow-xs);
}

/* === Chat Message Container === */
.chat-message-inline {
    display: flex;
    margin-bottom: 0.5rem;
    padding: 0 0.75rem;
}

.chat-message-inline-me {
    justify-content: flex-end;
}

.chat-message-inline-other {
    justify-content: flex-start;
    gap: 0.5rem;
}

.chat-message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.chat-message-content-me {
    align-items: flex-end;
}

/* === Chat Reply Quotes === */
.chat-reply-quote {
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.chat-reply-quote-me {
    background: rgba(255, 255, 255, 0.2);
    border-left: 3px solid rgba(255, 255, 255, 0.6);
}

.chat-reply-quote-other {
    background: var(--color-bg-surface-alt);
    border-left: 3px solid var(--color-primary);
}

.chat-reply-sender {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.chat-reply-sender-me {
    opacity: 0.9;
}

.chat-reply-sender-other {
    color: var(--color-primary);
}

.chat-reply-content {
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-reply-content-me {
    opacity: 0.8;
}

.chat-reply-content-other {
    color: var(--color-text-secondary);
}

/* === Chat Timestamps === */
.chat-timestamp {
    font-size: 0.6875rem;
    color: var(--color-text-tertiary);
    margin-top: 0.25rem;
}

.chat-timestamp-me {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chat-read-indicator {
    color: var(--color-primary);
}

.chat-unread-indicator {
    color: var(--color-text-tertiary);
}

/* === Chat Sender Name (Group Chat) === */
.chat-sender-name-inline {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

/* === Chat Message Layout === */
.chat-message {
    display: flex;
    margin-bottom: 0.5rem;
    padding: 0 0.75rem;
}

.chat-message-me {
    justify-content: flex-end;
}

.chat-message-other {
    justify-content: flex-start;
    gap: 0.5rem;
}

.chat-message-wrapper {
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.chat-message-wrapper-me {
    align-items: flex-end;
}

.chat-message-wrapper-other {
    align-items: flex-start;
}

/* === Chat Sender Name (Group Chat) === */
.chat-sender-name {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

/* === Chat Image (Inline) === */
.chat-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 0.25rem;
}

/* === Chat Avatar (Inline Replacement) === */
.chat-avatar-inline {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-weight: 600;
    flex-shrink: 0;
}

.chat-avatar-default {
    background: linear-gradient(135deg, var(--color-gray-400) 0%, var(--color-gray-500) 100%);
}

/* Avatar color palette for group chats */
.chat-avatar-color-1 { background: linear-gradient(135deg, var(--color-blue-400) 0%, var(--color-blue-500) 100%); }
.chat-avatar-color-2 { background: linear-gradient(135deg, var(--color-emerald-400) 0%, var(--color-emerald-500) 100%); }
.chat-avatar-color-3 { background: linear-gradient(135deg, var(--color-amber-400) 0%, var(--color-amber-500) 100%); }
.chat-avatar-color-4 { background: linear-gradient(135deg, var(--color-indigo-400) 0%, var(--color-indigo-500) 100%); }
.chat-avatar-color-5 { background: linear-gradient(135deg, var(--color-red-400) 0%, var(--color-red-500) 100%); }
.chat-avatar-color-6 { background: linear-gradient(135deg, var(--color-cyan-400) 0%, var(--color-cyan-500) 100%); }

/* === Notification Badge (Inline Replacement) === */
.notification-badge-inline {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--color-error);
    color: var(--color-text-inverse);
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

/* === Action Buttons (Inline Replacement) === */
.action-btn-inline {
    border: none;
    padding: 0 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: opacity 0.2s;
}

.action-btn-inline:hover {
    opacity: 0.9;
}

.action-btn-inline:active {
    opacity: 0.8;
}

.action-btn-primary {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.action-btn-danger {
    background: var(--color-error);
    color: var(--color-text-inverse);
}

.action-btn-success {
    background: var(--color-success);
    color: var(--color-text-inverse);
}

/* === Icon Buttons === */
.btn-icon-primary {
    background: linear-gradient(135deg, var(--color-blue-500) 0%, var(--color-blue-700) 100%);
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.btn-icon-primary:hover {
    opacity: 0.9;
}

/* === Notification Swipe Action Buttons === */
.notification-action-btn {
    border: none;
    padding: 0 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    width: 75px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Status Hint Boxes === */
.hint-box {
    border-radius: 8px;
    padding: 0.75rem;
}

.hint-box-primary {
    background: var(--hint-box-primary-bg);
    border: 1px solid var(--hint-box-primary-border);
}

.hint-box-success {
    background: var(--hint-box-success-bg);
    border: 1px solid var(--hint-box-success-border);
}

.hint-box-warning {
    background: var(--hint-box-warning-bg);
    border: 1px solid var(--hint-box-warning-border);
    color: var(--color-amber-800);
}

.hint-box-info {
    background: var(--hint-box-info-bg);
    border: 1px solid var(--hint-box-info-border);
}

/* LINE Green Hint Box */
.hint-box-line {
    background: rgba(6, 199, 85, 0.08);
    border: 1px solid rgba(6, 199, 85, 0.3);
}

.text-line {
    color: #06C755;
}

/* Hint box with left border accent */
.hint-box-accent {
    border-left-width: 4px;
}

/* === Chat Input Controls (Inline Replacement) === */
.chat-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
}

.chat-icon-btn:hover {
    background: var(--color-bg-surface-hover);
    color: var(--color-text-primary);
}

.chat-icon-btn-send {
    background: var(--chat-send-btn-bg);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-primary);
}

.chat-icon-btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
}

/* === Chat Input Field (Inline Replacement) === */
.chat-input-inline {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.9375rem;
    background: var(--chat-input-bg);
    color: var(--color-text-primary);
    outline: none;
    transition: all 0.2s;
}

.chat-input-inline:focus {
    border-color: var(--color-primary);
    background: var(--color-bg-surface);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}

/* === Recording Timer Overlay === */
.recording-timer-overlay {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0.5rem;
    background: var(--recording-overlay-bg);
    color: var(--color-white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    z-index: 100;
}

.recording-timer {
    font-variant-numeric: tabular-nums;
}

.recording-cancel-hint {
    margin-left: 0.5rem;
    opacity: 0.8;
    font-size: 0.75rem;
}

.recording-cancel-hint.is-cancel {
    color: var(--color-warning);
    font-weight: 600;
}

/* === Voice Button Recording State === */
.chat-icon-btn.is-recording {
    background: var(--color-error) !important;
    color: var(--color-white) !important;
    transform: scale(1.2);
    animation: pulse-recording 1s ease-in-out infinite;
}

@keyframes pulse-recording {
    0%, 100% { transform: scale(1.2); }
    50% { transform: scale(1.1); }
}

/* === Chat Reactions === */
.chat-reactions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.reaction-bubble {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    background: var(--color-gray-100);
    border: 1px solid var(--color-border-light);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8125rem;
}

.reaction-bubble:hover {
    background: var(--color-gray-200);
    border-color: var(--color-border);
}

.reaction-bubble-active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.reaction-bubble-active:hover {
    background: rgba(59, 130, 246, 0.25);
}

.reaction-emoji {
    font-size: 0.875rem;
    line-height: 1;
}

.reaction-count {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.reaction-count-active {
    color: var(--color-primary);
    font-weight: 600;
}

/* === Chat Reply Quote (for "me" messages) === */
.chat-reply-sender {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    opacity: 0.9;
}

.chat-reply-content {
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.8;
}

/* === Profile Avatar (Friends, Chat List) === */
.profile-avatar-inline {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-weight: 600;
    flex-shrink: 0;
}

.profile-avatar-sm {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
}

.profile-avatar-md {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
}

.profile-avatar-lg {
    width: 60px;
    height: 60px;
    font-size: 1.75rem;
}

.profile-avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 2.5rem;
    box-shadow: var(--shadow-md);
}

/* === Online Status Indicator === */
.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--color-success);
    border: 2px solid var(--color-bg-surface);
    border-radius: 50%;
}

/* === Friend Request Section (Warning Gradient) === */
.friend-request-section {
    background: var(--friend-request-section-bg);
    border-left: 4px solid var(--color-warning);
}

/* === QR Code Display === */
.qr-placeholder {
    width: 200px;
    height: 200px;
    margin: 0 auto 1rem;
    background: var(--qr-placeholder-bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.qr-container {
    width: 240px;
    height: 240px;
    margin: 0 auto 1rem;
    background: var(--color-bg-surface);
    border: 8px solid var(--color-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

/* === Invite Card === */
.invite-card {
    background: var(--invite-card-bg);
    padding: 1rem;
}

.invite-message-box {
    padding: 0.75rem;
    background: var(--color-bg-surface);
    border-radius: 8px;
}

/* === Notification Banner (Dashboard) === */
.notification-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    color: var(--color-white);
}

.notification-banner-primary {
    background: linear-gradient(135deg, var(--color-blue-500) 0%, var(--color-blue-700) 100%);
}

.notification-banner-warning {
    background: linear-gradient(135deg, var(--color-amber-500) 0%, var(--color-amber-600) 100%);
}

.notification-banner-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Map Container === */
.map-container {
    background: var(--color-blue-50);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.map-info-overlay {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 1000;
    background: var(--color-bg-surface);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    font-size: 0.8125rem;
}

/* === Empty State Illustration === */
.empty-state-illustration {
    width: 180px;
    height: 180px;
    margin: 0 auto 1.5rem;
    background: var(--qr-placeholder-bg);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Required Field Indicator === */
.required-mark {
    color: var(--color-error);
}

/* === Gradient Cards (Dashboard, Register) === */
.gradient-card-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white);
}

.gradient-card-success {
    background: linear-gradient(135deg, var(--color-success) 0%, var(--color-emerald-600) 100%);
    color: var(--color-white);
}

.gradient-card-purple {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--color-white);
}

/* === Stat Cards (Inspection Summary) === */
.stat-card {
    padding: 1rem;
    text-align: center;
    border-radius: var(--radius-md);
}

.stat-card-warning {
    background: linear-gradient(135deg, var(--color-amber-100) 0%, var(--color-amber-200) 100%);
}

.stat-card-success {
    background: linear-gradient(135deg, var(--color-emerald-100) 0%, var(--color-emerald-200) 100%);
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-card-warning .stat-card-value {
    color: var(--color-amber-700);
}

.stat-card-success .stat-card-value {
    color: var(--color-emerald-700);
}

.stat-card-label {
    font-size: 0.8125rem;
}

.stat-card-warning .stat-card-label {
    color: var(--color-amber-800);
}

.stat-card-success .stat-card-label {
    color: var(--color-emerald-800);
}

/* === Task Card with Border Accent === */
.task-card-accent {
    padding: 0.875rem;
    border-left-width: 3px;
    border-left-style: solid;
}

.task-card-accent-warning {
    border-left-color: var(--color-amber-500);
}

.task-card-accent-success {
    border-left-color: var(--color-emerald-500);
    opacity: 0.9;
}

/* === Subtle Gradient Cards === */
.card-gradient-subtle {
    background: linear-gradient(135deg, var(--color-gray-50) 0%, var(--color-gray-200) 100%);
}

[data-theme="dark"] .card-gradient-subtle {
    background: linear-gradient(135deg, var(--color-gray-800) 0%, var(--color-gray-700) 100%);
}

/* === Avatar Gradient Backgrounds === */
/* Used for chat avatars, contact lists, etc. */
.avatar-gradient-1 { background: linear-gradient(135deg, var(--color-blue-400), var(--color-blue-600)); }
.avatar-gradient-2 { background: linear-gradient(135deg, var(--color-emerald-400), var(--color-emerald-600)); }
.avatar-gradient-3 { background: linear-gradient(135deg, var(--color-violet-400), var(--color-violet-600)); }
.avatar-gradient-4 { background: linear-gradient(135deg, var(--color-amber-400), var(--color-amber-600)); }
.avatar-gradient-5 { background: linear-gradient(135deg, var(--color-pink-400), var(--color-pink-600)); }
.avatar-gradient-6 { background: linear-gradient(135deg, var(--color-rose-400), var(--color-rose-600)); }
.avatar-gradient-7 { background: linear-gradient(135deg, var(--color-orange-400), var(--color-orange-600)); }

/* Dark mode - slightly adjusted for better contrast */
[data-theme="dark"] .avatar-gradient-1 { background: linear-gradient(135deg, var(--color-blue-500), var(--color-blue-700)); }
[data-theme="dark"] .avatar-gradient-2 { background: linear-gradient(135deg, var(--color-emerald-500), var(--color-emerald-700)); }
[data-theme="dark"] .avatar-gradient-3 { background: linear-gradient(135deg, var(--color-violet-500), var(--color-violet-700)); }
[data-theme="dark"] .avatar-gradient-4 { background: linear-gradient(135deg, var(--color-amber-500), var(--color-amber-700)); }
[data-theme="dark"] .avatar-gradient-5 { background: linear-gradient(135deg, var(--color-pink-500), var(--color-pink-700)); }
[data-theme="dark"] .avatar-gradient-6 { background: linear-gradient(135deg, var(--color-rose-500), var(--color-rose-700)); }
[data-theme="dark"] .avatar-gradient-7 { background: linear-gradient(135deg, var(--color-orange-500), var(--color-orange-700)); }

/* === Decorative Hero/Banner Gradients === */
.hero-gradient-dark {
    background: linear-gradient(135deg, var(--color-gray-900) 0%, var(--color-slate-800) 50%, var(--color-blue-900) 100%);
}

.hero-gradient-purple {
    background: linear-gradient(135deg, var(--color-indigo-500) 0%, var(--color-purple-600) 100%);
}

.hero-gradient-error {
    background: linear-gradient(135deg, var(--color-red-600) 0%, var(--color-red-700) 100%);
}

/* Quick Action Button Gradients */
.btn-gradient-chat { background: linear-gradient(135deg, var(--color-blue-500), var(--color-teal-500)); }
.btn-gradient-project { background: linear-gradient(135deg, var(--color-orange-500), var(--color-orange-600)); }
.btn-gradient-finance { background: linear-gradient(135deg, var(--color-emerald-500), var(--color-emerald-600)); }

/* Placeholder Gradients */
.placeholder-gradient-light {
    background: linear-gradient(135deg, var(--color-gray-100) 0%, var(--color-gray-200) 100%);
}

.placeholder-gradient-map {
    background: linear-gradient(135deg, var(--color-sky-100) 0%, var(--color-sky-200) 100%);
}

[data-theme="dark"] .placeholder-gradient-light {
    background: linear-gradient(135deg, var(--color-gray-700) 0%, var(--color-gray-600) 100%);
}

[data-theme="dark"] .placeholder-gradient-map {
    background: linear-gradient(135deg, var(--color-sky-900) 0%, var(--color-sky-800) 100%);
}

/* Company/Business Avatar */
.company-avatar-gradient {
    background: linear-gradient(135deg, var(--color-indigo-500) 0%, var(--color-purple-600) 100%);
}

/* === LINE Style Button === */
.btn-line {
    background: #06C755;
    color: var(--color-white);
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    transition: opacity 0.2s;
}

.btn-line:hover {
    opacity: 0.9;
}

/* === Image Gallery Controls === */
.image-gallery-indicator {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: var(--image-overlay-bg);
    color: var(--color-white);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.image-gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--image-overlay-bg);
    color: var(--color-white);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: opacity 0.2s;
}

.image-gallery-btn:hover {
    opacity: 0.9;
}

.image-gallery-btn-prev {
    left: 12px;
}

.image-gallery-btn-next {
    right: 12px;
}

/* === Unread Chat Highlight === */
.chat-item-unread {
    background: var(--color-info-bg);
}

/* === Required Field Indicator === */
.required-indicator {
    color: var(--color-error);
}

/* === Stats Display (Friend Profile) === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 1rem;
    background: var(--color-bg-surface-alt);
    border-radius: 8px;
}

.stats-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stats-value-success {
    color: var(--color-success);
}

.stats-value-warning {
    color: var(--color-warning);
}

.stats-label {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
}

/* === Calendar Legend Dots === */
.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot-milestone { background: var(--color-blue-500); }
.legend-dot-inspection { background: var(--color-emerald-500); }
.legend-dot-meeting { background: var(--color-amber-500); }
.legend-dot-deadline { background: var(--color-red-500); }
.legend-dot-start { background: var(--color-violet-500); }
.legend-dot-acceptance { background: var(--color-pink-500); }


/* === Friend Profile / Collaboration Components === */
.group-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.group-option:hover {
    background: var(--bg-secondary);
}

.group-icon-placeholder {
    width: 40px;
    height: 40px;
    background: var(--color-blue-50);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.check-icon-primary {
    color: var(--color-primary);
    font-size: 1.25rem;
}

.scrollable-list-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.scrollable-list-container-sm {
    max-height: 250px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.stats-grid-item {
    text-align: center;
}

.stats-grid-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.stats-grid-value-primary {
    color: var(--color-primary);
}

.stats-grid-value-success {
    color: var(--color-success);
}

.stats-grid-value-warning {
    color: var(--color-amber-500);
}

.stats-grid-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.history-list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.section-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
}

/* === QR Code Placeholder === */
.qr-code-placeholder {
    width: 200px;
    height: 200px;
    background:
        linear-gradient(45deg, var(--color-gray-200) 25%, transparent 25%, transparent 75%, var(--color-gray-200) 75%, var(--color-gray-200)),
        linear-gradient(45deg, var(--color-gray-200) 25%, transparent 25%, transparent 75%, var(--color-gray-200) 75%, var(--color-gray-200));
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.qr-code-label {
    font-size: 10px;
    margin-top: 8px;
    color: var(--text-tertiary);
}

/* === Membership / Pricing Components === */
.plan-banner-vip {
    background: linear-gradient(135deg, var(--color-amber-100) 0%, var(--color-yellow-300) 100%);
    border: 2px solid var(--color-amber-400);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.plan-banner-label {
    font-size: 0.75rem;
    color: var(--color-amber-800);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.plan-banner-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-amber-900);
    margin-bottom: 0.5rem;
}

.plan-banner-date {
    font-size: 0.875rem;
    color: var(--color-amber-800);
}

.plan-banner-watermark {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 4rem;
    opacity: 0.15;
}

.plan-card-active {
    border: 2px solid var(--color-primary);
    position: relative;
    padding: 1.25rem;
}

.plan-card-muted {
    background: var(--bg-secondary);
    padding: 1.25rem;
    opacity: 0.8;
}

.plan-card-enterprise {
    border: 2px solid var(--color-violet-400);
    background: var(--color-violet-50);
    padding: 1.25rem;
}

.plan-current-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--color-primary);
    color: var(--color-white);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-bottom-left-radius: 0.5rem;
    font-weight: 600;
}

.plan-price {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.plan-feature-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    list-style: none;
    padding: 0;
}

.plan-feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.plan-feature-highlight {
    color: var(--color-primary);
    font-weight: 600;
}

.plan-feature-list-muted {
    color: var(--text-secondary);
}

.page-footer-text {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0 1rem;
}

.link-primary {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
}

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

/* === File Manager Components === */
.folder-tree-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.folder-tree-item:hover {
    background: var(--bg-secondary);
}

.folder-tree-item-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.folder-tree-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.folder-tree-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-tertiary);
}

.file-extension {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.file-original-name {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
}

.current-location-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* === Status Cards with Border Accent === */
.status-card-info {
    background: linear-gradient(135deg, var(--color-blue-50) 0%, var(--color-sky-100) 100%);
    border-left: 4px solid var(--color-primary);
}

.status-card-warning {
    background: linear-gradient(135deg, var(--color-amber-100) 0%, var(--color-amber-200) 100%);
    border-left: 4px solid var(--color-warning);
}

.status-card-success {
    background: linear-gradient(135deg, var(--color-emerald-100) 0%, var(--color-emerald-200) 100%);
    border-left: 4px solid var(--color-success);
}

/* === Worker Theme Components === */
.worker-card-accent {
    border-left: 5px solid var(--worker-color, var(--color-emerald-500));
}

.worker-text {
    color: var(--worker-color, var(--color-emerald-500));
}

.worker-progress-fill {
    background: var(--worker-color, var(--color-emerald-500));
}

/* === Notice Box === */
.notice-box-warning {
    background: var(--color-amber-50);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: pre-line;
    border-left: 3px solid var(--color-amber-500);
}

/* === Code Block === */
.code-block {
    background: var(--bg-tertiary);
    padding: 8px;
    border-radius: 4px;
    display: block;
    margin-top: 8px;
    font-family: monospace;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
