/* CKY_MOBILE_LAYOUT_V1
   Mobile-first information hierarchy for client and engineer dashboards.
   This file intentionally does not change backend business logic. */

.cky-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.cky-dashboard-topbar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 5px 18px rgba(15, 23, 42, .06);
}

.cky-topbar-brand,
.cky-topbar-actions,
.cky-profile-summary-main,
.cky-engineer-card-head,
.cky-engineer-meta-row,
.cky-marketplace-title-row,
.cky-review-heading {
    min-width: 0;
}

.cky-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cky-topbar-mark {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: #ebf8ff;
    font-size: 20px;
}

.cky-topbar-brand strong,
.cky-topbar-brand small {
    display: block;
    overflow-wrap: anywhere;
}

.cky-topbar-brand strong {
    color: #1e293b;
    font-size: 1.03rem;
}

.cky-topbar-brand small {
    margin-top: 2px;
    color: #64748b;
    font-size: .78rem;
}

.cky-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
}

.cky-dashboard-topbar .lang-switch {
    position: static;
    inset: auto;
    z-index: auto;
    gap: 6px;
}

.cky-dashboard-topbar .lang-switch button {
    padding: 6px 12px;
    min-height: 36px;
}

.cky-lang-mobile {
    display: none;
    margin: 0;
}

.cky-lang-mobile select {
    width: auto;
    min-width: 72px;
    min-height: 40px;
    padding: 7px 28px 7px 10px;
    border-radius: 10px;
    background: #fff;
    font-size: 16px;
    font-weight: 700;
}

.cky-logout-form {
    display: block;
    margin: 0;
}

.cky-logout-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: #64748b;
    color: #fff;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
}

.cky-client-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
}

.cky-search-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(130px, 1fr);
    gap: 10px;
    align-items: center;
}

.cky-search-actions .btn-primary,
.cky-reset-link {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-weight: 700;
    text-align: center;
}

.cky-reset-link {
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    text-decoration: none;
}

.cky-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
}

.cky-section-heading h2 {
    min-width: 0;
    margin: 0;
    color: #2d3748;
    font-size: 1.55rem;
    overflow-wrap: anywhere;
}

.cky-result-count {
    flex: 0 0 auto;
    min-width: 34px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: .82rem;
    font-weight: 800;
}

.cky-engineer-summary-card {
    gap: 13px !important;
}

.cky-engineer-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cky-engineer-summary-card .avatar-lazy {
    width: 76px;
    height: 76px;
    border-radius: 14px;
}

.cky-engineer-heading-copy {
    flex: 1;
    min-width: 0;
}

.cky-engineer-heading-copy h3,
.cky-profile-identity h2,
.cky-marketplace-title-row h3 {
    margin: 0;
    color: #1e293b;
    overflow-wrap: anywhere;
}

.cky-engineer-heading-copy h3 {
    font-size: 1.18rem;
}

.cky-engineer-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 7px;
}

.cky-rating-compact {
    color: #b7791f;
    font-weight: 800;
    font-size: .88rem;
}

.cky-rating-compact small {
    color: #718096;
    font-weight: 600;
}

.cky-summary-block {
    display: grid;
    gap: 8px;
}

.cky-summary-tags,
.cky-full-tag-list,
.cky-current-service-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    min-width: 0;
}

.cky-summary-tag,
.cky-summary-more {
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .79rem;
    font-weight: 750;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.cky-summary-tag {
    background: #ebf8ff;
    color: #2563a9;
}

.cky-summary-more {
    background: #e2e8f0;
    color: #475569;
}

.cky-area-summary {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    margin: 0;
    color: #64748b;
    font-size: .84rem;
    line-height: 1.4;
}

.cky-area-summary span:nth-child(2) {
    min-width: 0;
    overflow-wrap: anywhere;
}

.cky-area-summary strong {
    flex: 0 0 auto;
    color: #475569;
}

.cky-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.cky-card-actions button {
    width: 100%;
    margin: 0 !important;
    min-height: 44px;
    padding: 10px 12px;
}

.cky-reviewed-label {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 12px;
    border-radius: 8px;
    background: #f0fff4;
    color: #2f855a;
    font-size: .86rem;
    font-weight: 700;
}

.cky-contact-result {
    padding: 10px 12px;
    border-radius: 8px;
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #276749;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.cky-contact-result[hidden] {
    display: none;
}

.cky-engineer-details,
.cky-reviews-details,
.cky-profile-section {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    overflow: hidden;
}

.cky-engineer-details > summary,
.cky-reviews-details > summary,
.cky-profile-section > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 46px;
    padding: 11px 13px;
    color: #334155;
    font-size: .9rem;
    font-weight: 800;
    cursor: pointer;
}

.cky-engineer-details > summary::-webkit-details-marker,
.cky-reviews-details > summary::-webkit-details-marker,
.cky-profile-section > summary::-webkit-details-marker {
    display: none;
}

.cky-details-chevron {
    transition: transform .2s ease;
}

.cky-engineer-details[open] .cky-details-chevron {
    transform: rotate(180deg);
}

.cky-engineer-details-body,
.cky-profile-section-body {
    padding: 4px 13px 14px;
}

.cky-detail-section {
    padding: 12px 0;
    border-top: 1px solid #e2e8f0;
}

.cky-detail-section:first-child {
    border-top: 0;
}

.cky-detail-section h4 {
    margin: 0 0 9px;
    color: #334155;
    font-size: .92rem;
}

.cky-full-tag-list .tag,
.cky-full-tag-list .area-tag {
    display: inline-flex !important;
    margin: 0 !important;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.cky-qualification-copy {
    margin: 0;
    color: #475569;
    font-size: .9rem;
    line-height: 1.58;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.cky-reviews-details {
    margin-top: 10px;
    background: #fff;
}

.cky-reviews-details > summary {
    justify-content: flex-start;
}

.cky-reviews-static {
    display: block !important;
    margin: 0 12px 12px;
}

.cky-review-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.cky-review-stars {
    flex: 0 0 auto;
    color: #d69e2e;
}

.cky-empty-copy {
    margin: 0;
    color: #718096;
    text-align: center;
}

.cky-profile-shell {
    display: grid !important;
    gap: 14px !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.cky-profile-summary-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 15px rgba(15, 23, 42, .05);
}

.cky-profile-summary-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cky-avatar-compact {
    flex: 0 0 92px;
    width: 92px !important;
    height: 92px !important;
    border-width: 3px !important;
}

.cky-profile-identity {
    flex: 1;
    min-width: 0;
}

.cky-profile-identity h2 {
    font-size: 1.4rem;
}

.cky-profile-section {
    width: 100%;
    background: #fff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .04);
}

.cky-profile-section[open] > summary {
    border-bottom: 1px solid #e2e8f0;
    color: #2563a9;
}

.cky-profile-section > summary::after {
    content: '⌄';
    flex: 0 0 auto;
    transition: transform .2s ease;
}

.cky-profile-section[open] > summary::after {
    transform: rotate(180deg);
}

.cky-avatar-editor {
    box-shadow: none;
}

.cky-avatar-editor form {
    width: 100% !important;
}

.cky-avatar-editor input[type="file"],
.cky-profile-section input[type="file"] {
    font-size: 16px !important;
}

.cky-profile-section .cky-cidb-status-card {
    margin: 0;
}

.cky-profile-section .cky-service-profile-form {
    margin-top: 14px;
}

.cky-danger-section > summary {
    color: #9b2c2c;
}

.cky-danger-section .danger-zone {
    margin: 0;
}

.cky-marketplace-grid {
    display: grid;
    gap: 13px;
}

.cky-marketplace-card {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, .04);
}

.cky-marketplace-avatar {
    flex: 0 0 66px;
    width: 66px;
    height: 66px;
    border-radius: 12px;
    object-fit: cover;
    background: #edf2f7;
}

.cky-marketplace-copy {
    flex: 1;
    min-width: 0;
}

.cky-marketplace-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 8px;
}

.cky-marketplace-title-row h3 {
    font-size: 1rem;
}

/* Mobile contact button: round floating action button + bottom sheet. */
@media (max-width: 700px) {
    .cky-contact-widget {
        left: 14px !important;
        top: auto !important;
        bottom: calc(78px + env(safe-area-inset-bottom)) !important;
        transform: none !important;
    }

    .cky-contact-tab {
        width: 52px !important;
        height: 52px !important;
        min-height: 52px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        box-shadow: 0 8px 24px rgba(15, 23, 42, .28) !important;
    }

    .cky-contact-tab span:last-child {
        display: none !important;
    }

    .cky-contact-icon {
        font-size: 22px !important;
    }

    .cky-contact-panel {
        left: 10px !important;
        right: 10px !important;
        top: auto !important;
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-height: min(78vh, 620px) !important;
        padding: 24px 18px 18px !important;
        border-radius: 18px !important;
        transform: translateY(115%) !important;
        overflow-y: auto;
    }

    .cky-contact-widget.is-open .cky-contact-panel {
        transform: translateY(0) !important;
    }

    .cky-contact-widget.is-open .cky-contact-tab {
        transform: none !important;
        visibility: hidden !important;
    }
}

@media (max-width: 700px) {
    body {
        padding: 10px 8px calc(20px + env(safe-area-inset-bottom));
    }

    body .dashboard {
        padding: 0 !important;
        margin: 0 auto !important;
    }

    .cky-dashboard-topbar {
        position: relative;
        align-items: center;
        gap: 9px;
        margin-bottom: 12px;
        padding: 10px 11px;
        border-radius: 12px;
    }

    .cky-topbar-mark {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    .cky-topbar-brand {
        flex: 1;
        min-width: 0;
        gap: 8px;
    }

    .cky-topbar-brand strong {
        font-size: .94rem;
    }

    .cky-topbar-brand small {
        font-size: .69rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .cky-topbar-actions {
        flex: 0 0 auto;
        gap: 6px;
    }

    .cky-lang-desktop {
        display: none !important;
    }

    .cky-lang-mobile {
        display: block;
    }

    .cky-lang-mobile select {
        min-width: 66px;
        min-height: 38px;
        padding: 6px 24px 6px 8px;
        border-radius: 9px;
    }

    .cky-logout-button {
        width: 40px;
        min-width: 40px;
        height: 38px;
        min-height: 38px;
        padding: 0;
        border-radius: 9px;
        font-size: 1rem;
    }

    .cky-logout-button span:last-child {
        display: none;
    }

    .client-header {
        gap: 14px !important;
        margin-bottom: 20px !important;
        padding: 14px !important;
    }

    .client-avatar-fixed {
        width: 52px !important;
        height: 52px !important;
        font-size: 1.45rem !important;
    }

    .client-details h2 {
        font-size: 1.08rem !important;
    }

    .cky-modern-search-form {
        gap: 10px !important;
    }

    .cky-search-actions {
        grid-template-columns: minmax(0, 1.8fr) minmax(110px, 1fr);
        gap: 8px;
    }

    .cky-search-actions .btn-primary,
    .cky-reset-link {
        min-height: 44px;
        padding: 9px 10px;
        font-size: .92rem;
    }

    .cky-section-heading {
        margin-bottom: 12px;
        padding: 0 2px;
    }

    .cky-section-heading h2 {
        font-size: 1.38rem;
    }

    .list-container {
        gap: 12px !important;
    }

    .cky-engineer-summary-card {
        padding: 14px !important;
        border-radius: 14px !important;
    }

    .cky-engineer-summary-card .avatar-lazy {
        width: 68px !important;
        height: 68px !important;
        border-radius: 12px !important;
    }

    .cky-engineer-card-head {
        align-items: flex-start;
        gap: 11px;
    }

    .cky-engineer-heading-copy h3 {
        font-size: 1.07rem;
    }

    .cky-engineer-meta-row {
        gap: 5px;
    }

    .cky-cidb-badge {
        max-width: 100%;
        padding: 4px 8px !important;
        font-size: .72rem !important;
    }

    .cky-summary-tag,
    .cky-summary-more {
        padding: 4px 8px;
        font-size: .75rem;
    }

    .cky-card-actions {
        grid-template-columns: 1fr;
    }

    .cky-engineer-details > summary,
    .cky-reviews-details > summary,
    .cky-profile-section > summary {
        min-height: 44px;
        padding: 10px 11px;
        font-size: .86rem;
    }

    .cky-engineer-details-body,
    .cky-profile-section-body {
        padding: 3px 11px 12px;
    }

    .cky-profile-summary-card {
        padding: 14px;
    }

    .cky-profile-summary-main {
        align-items: flex-start;
        gap: 11px;
    }

    .cky-avatar-compact {
        flex-basis: 78px;
        width: 78px !important;
        height: 78px !important;
    }

    .cky-profile-identity h2 {
        font-size: 1.18rem;
    }

    .dash-nav {
        gap: 8px !important;
        margin-bottom: 16px !important;
        padding-bottom: 8px !important;
    }

    .dash-nav button {
        min-height: 44px;
        padding: 9px 13px !important;
        font-size: .95rem !important;
    }

    .portfolio-usage-card,
    #portfolioUploadForm {
        padding: 13px !important;
    }

    .cky-marketplace-card {
        gap: 10px;
        padding: 13px;
    }

    .cky-marketplace-avatar {
        flex-basis: 58px;
        width: 58px;
        height: 58px;
    }

    .cky-marketplace-title-row {
        display: grid;
        justify-content: stretch;
    }
}

@media (max-width: 360px) {
    .cky-topbar-brand small {
        display: none;
    }

    .cky-lang-mobile select {
        min-width: 60px;
    }

    .cky-search-actions {
        grid-template-columns: 1fr;
    }

    .cky-profile-summary-main {
        align-items: center;
    }

    .cky-avatar-compact {
        flex-basis: 68px;
        width: 68px !important;
        height: 68px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cky-details-chevron,
    .cky-profile-section > summary::after {
        transition: none;
    }
}
