/*
 * GG Drive Browser 1.6.1
 * Responsive app-style browser refresh.
 */

.gg-drive-browser {
    --ggdb-bg: #ffffff;
    --ggdb-surface: #ffffff;
    --ggdb-soft: #f5f7fa;
    --ggdb-border: #dfe5ec;
    --ggdb-border-strong: #cfd8e3;
    --ggdb-text: #202833;
    --ggdb-muted: #758294;
    --ggdb-accent: #d51f26;
    --ggdb-accent-hover: #b91a20;
    --ggdb-blue: #315d91;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    color: var(--ggdb-text);
    font: inherit;
    box-shadow: none;
    border: 0;
}

.gg-drive-browser *,
.gg-drive-browser *::before,
.gg-drive-browser *::after {
    box-sizing: border-box;
}

/* ---------- Toolbar / search ---------- */
.gg-drive-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.gg-drive-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    min-height: 38px;
    padding: 7px 11px;
    border: 1px solid var(--ggdb-border);
    border-radius: 10px;
    background: var(--ggdb-surface);
    color: var(--ggdb-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none !important;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.gg-drive-back:hover,
.gg-drive-back:focus-visible {
    background: var(--ggdb-soft);
    border-color: var(--ggdb-border-strong);
    color: var(--ggdb-text);
}

.gg-drive-back-arrow {
    font-size: 18px;
    line-height: 1;
}

.gg-drive-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.gg-drive-search-field {
    position: relative;
    min-width: 0;
}

.gg-drive-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 19px;
    height: 19px;
    transform: translateY(-50%);
    color: #8b97a7;
    pointer-events: none;
}

.gg-drive-search-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.gg-drive-browser .gg-drive-search input[type="search"] {
    display: block;
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 15px 0 43px;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--ggdb-border-strong);
    border-radius: 12px;
    outline: none;
    background: #fff;
    color: var(--ggdb-text);
    font: inherit;
    font-size: 15px;
    line-height: 48px;
    box-shadow: 0 1px 2px rgba(21, 34, 51, .03);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.gg-drive-browser .gg-drive-search input[type="search"]::placeholder {
    color: #96a0ad;
    opacity: 1;
}

.gg-drive-browser .gg-drive-search input[type="search"]:focus {
    border-color: #9fb3c9;
    box-shadow: 0 0 0 3px rgba(49, 93, 145, .10);
}

.gg-drive-browser .gg-drive-search input[type="search"]::-webkit-search-decoration,
.gg-drive-browser .gg-drive-search input[type="search"]::-webkit-search-cancel-button,
.gg-drive-browser .gg-drive-search input[type="search"]::-webkit-search-results-button,
.gg-drive-browser .gg-drive-search input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
}

.gg-drive-search-button {
    height: 48px;
    margin: 0;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    background: var(--ggdb-accent);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(213, 31, 38, .16);
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.gg-drive-search-button:hover,
.gg-drive-search-button:focus-visible {
    background: var(--ggdb-accent-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(213, 31, 38, .20);
}

.gg-drive-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 4px;
    color: var(--ggdb-muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
}

.gg-drive-clear:hover,
.gg-drive-clear:focus-visible {
    color: var(--ggdb-text);
}

/* ---------- Result summary ---------- */
.gg-drive-results-summary {
    margin: -2px 0 13px;
    padding: 0 2px;
    color: var(--ggdb-muted);
    font-size: 13px;
}

.gg-drive-results-summary strong {
    color: var(--ggdb-text);
}

/* ---------- File list ---------- */
.gg-drive-list {
    overflow: hidden;
    border: 1px solid var(--ggdb-border);
    border-radius: 14px;
    background: var(--ggdb-surface);
    box-shadow: 0 6px 22px rgba(32, 40, 51, .045);
}

.gg-drive-item {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 68px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--ggdb-border);
    color: var(--ggdb-text) !important;
    text-decoration: none !important;
    transition: background .13s ease;
}

.gg-drive-item:last-child {
    border-bottom: 0;
}

.gg-drive-item:hover,
.gg-drive-item:focus-visible {
    background: #f7f9fb;
    color: var(--ggdb-text) !important;
    outline: none;
}

.gg-drive-item-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 11px;
    background: #edf1f5;
    color: #657588;
}

.gg-drive-item-icon svg {
    display: block;
    width: 23px;
    height: 23px;
}


.gg-drive-item-icon {
    position: relative;
}

.gg-drive-item-icon-label {
    position: absolute;
    right: 3px;
    bottom: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    max-width: calc(100% - 6px);
    height: 11px;
    padding: 0 3px;
    border-radius: 999px;
    background: rgba(255,255,255,.96);
    color: currentColor;
    font-size: 7px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .04em;
    text-transform: uppercase;
    box-shadow: 0 1px 2px rgba(32,40,51,.10);
    overflow: hidden;
    white-space: nowrap;
}

.gg-drive-item--image .gg-drive-item-icon-label,
.gg-drive-item--slide .gg-drive-item-icon-label,
.gg-drive-item--sheet .gg-drive-item-icon-label,
.gg-drive-item--doc .gg-drive-item-icon-label,
.gg-drive-item--pdf .gg-drive-item-icon-label {
    background: rgba(255,255,255,.96);
}

.gg-drive-item--folder .gg-drive-item-icon {
    background: #edf3fa;
    color: #315d91;
}

.gg-drive-item--pdf .gg-drive-item-icon {
    background: #fceced;
    color: #c51d25;
}

.gg-drive-item--doc .gg-drive-item-icon {
    background: #edf3fa;
    color: #3568a8;
}

.gg-drive-item--sheet .gg-drive-item-icon {
    background: #edf7f1;
    color: #2e7d4f;
}

.gg-drive-item--slide .gg-drive-item-icon {
    background: #fff3e6;
    color: #b66b18;
}

.gg-drive-item--image .gg-drive-item-icon {
    background: #f2edfa;
    color: #7050a0;
}

.gg-drive-item-copy {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.gg-drive-item-name {
    min-width: 0;
    color: var(--ggdb-text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.32;
    overflow-wrap: anywhere;
}

.gg-drive-item-meta {
    color: var(--ggdb-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
}

.gg-drive-item-action {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    color: #a0aab7;
}

.gg-drive-item-action svg {
    display: block;
    width: 18px;
    height: 18px;
}

.gg-drive-item:hover .gg-drive-item-action,
.gg-drive-item:focus-visible .gg-drive-item-action {
    color: #647386;
}

/* ---------- Empty state ---------- */
.gg-drive-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 28px 20px;
    border: 1px dashed var(--ggdb-border-strong);
    border-radius: 14px;
    background: rgba(255,255,255,.72);
    text-align: center;
}

.gg-drive-empty-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 11px;
    border-radius: 13px;
    background: #edf3fa;
    color: #7389a3;
}

.gg-drive-empty-icon svg {
    width: 25px;
    height: 25px;
}

.gg-drive-empty strong {
    color: var(--ggdb-text);
    font-size: 15px;
}

.gg-drive-empty p {
    margin: 6px 0 0;
    color: var(--ggdb-muted);
    font-size: 13px;
}

/* ---------- Agent Login integration ---------- */
.ggap-portal-preview .gg-drive-browser,
.ggal-manager-mode .gg-drive-browser {
    --ggdb-text: var(--ggap-text, #202833);
    --ggdb-muted: var(--ggap-muted, #758294);
    --ggdb-border: var(--ggap-border, #dfe5ec);
    --ggdb-accent: var(--ggap-red, #d51f26);
    --ggdb-accent-hover: var(--ggap-red-dark, #b91a20);
}

/* ---------- Mobile ---------- */
@media (max-width: 680px) {
    .gg-drive-toolbar {
        gap: 10px;
        margin-bottom: 13px;
    }

    .gg-drive-search {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .gg-drive-search-button {
        padding: 0 16px;
    }

    .gg-drive-clear {
        grid-column: 1 / -1;
        justify-self: start;
        height: 30px;
        padding-left: 2px;
    }

    .gg-drive-list {
        border-radius: 12px;
        box-shadow: none;
    }

    .gg-drive-item {
        min-height: 72px;
        gap: 12px;
        padding: 12px;
    }

    .gg-drive-item-icon {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
        border-radius: 10px;
    }

    .gg-drive-item-icon svg {
        width: 22px;
        height: 22px;
    }

    .gg-drive-item-icon-label {
        right: 2px;
        bottom: 2px;
        min-width: 17px;
        height: 10px;
        font-size: 6.5px;
        padding: 0 2px;
    }

    .gg-drive-item-name {
        font-size: 14px;
    }

    .gg-drive-item-meta {
        font-size: 11.5px;
    }
}

@media (max-width: 420px) {
    .gg-drive-browser .gg-drive-search input[type="search"] {
        height: 46px;
        line-height: 46px;
        font-size: 14px;
        padding-left: 40px;
    }

    .gg-drive-search-button {
        height: 46px;
        padding: 0 14px;
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gg-drive-browser *,
    .gg-drive-browser *::before,
    .gg-drive-browser *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
