/* ─────────────────────────────────────────────────────────────────
   MyCloud Frontend — Google Drive style
───────────────────────────────────────────────────────────────── */

.mycloud-fe {
    margin: 20px 0;
    position: relative;
    width: 100%;
    max-width: 100%;
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-sizing: border-box;
}

.mycloud-fe *,
.mycloud-fe *::before,
.mycloud-fe *::after {
    box-sizing: border-box;
}

/* ─────────────────────────────────────────────────────────────────
   Search
───────────────────────────────────────────────────────────────── */

.mc-fe-search-wrap {
    margin-bottom: 20px;
    position: relative;
}

.mc-fe-search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #F2F3F6;
    border-radius: 50px;
    color: #222C60;
    outline: none;
    background: #fff;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.mc-fe-search-input::-webkit-search-cancel-button,
.mc-fe-search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.mc-fe-search-input:focus {
    border-color: #222C60;
}

.mc-fe-search-clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #aaa;
    line-height: 1;
    padding: 0;
    display: none;
}

.mc-fe-search-clear:hover {
    color: #222C60;
}

/* ─────────────────────────────────────────────────────────────────
   Breadcrumb
───────────────────────────────────────────────────────────────── */

.mc-fe-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

.mc-fe-crumb {
    background: transparent;
    border: none;
    color: #222C60;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
}

.mc-fe-crumb:last-child {
    opacity: 1;
    font-weight: 600;
    cursor: default;
}

.mc-fe-crumb:not(:last-child):hover {
    opacity: 1;
    background: #F2F3F6;
}

.mc-fe-crumb-sep {
    color: #aaa;
    font-size: 13px;
}

/* ─────────────────────────────────────────────────────────────────
   Content wrapper
───────────────────────────────────────────────────────────────── */

.mc-fe-content {
    position: relative;
    min-height: 80px;
}

/* ─────────────────────────────────────────────────────────────────
   Items grid — columns via data attribute
───────────────────────────────────────────────────────────────── */

.mc-fe-items {
    display: grid;
    gap: 14px;
    margin-bottom: 30px;
    width: 100%;
}

/* Grid view — icon on top */
.mc-fe-items[data-view="grid"][data-columns="1"] { grid-template-columns: 1fr; }
.mc-fe-items[data-view="grid"][data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
.mc-fe-items[data-view="grid"][data-columns="3"] { grid-template-columns: repeat(3, 1fr); }
.mc-fe-items[data-view="grid"][data-columns="4"] { grid-template-columns: repeat(4, 1fr); }

/* List view — always single column */
.mc-fe-items[data-view="list"] { grid-template-columns: 1fr !important; }

/* ─────────────────────────────────────────────────────────────────
   Individual item — shared base
───────────────────────────────────────────────────────────────── */

.mc-fe-item {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 0;
    transition: transform 0.2s ease;
    min-width: 0;
    font-family: inherit;
}

.mc-fe-item:hover {
    transform: translateX(3px);
    text-decoration: none;
    color: inherit;
}

.mc-fe-item:hover .mc-fe-item-name {
    color: #EFC464;
}

/* ─────────────────────────────────────────────────────────────────
   Grid view overrides — stack icon above name
───────────────────────────────────────────────────────────────── */

.mc-fe-items[data-view="grid"] .mc-fe-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.mc-fe-items[data-view="grid"] .mc-fe-item:hover {
    transform: translateY(-3px);
}

/* ─────────────────────────────────────────────────────────────────
   Icon
───────────────────────────────────────────────────────────────── */

.mc-fe-item-icon {
    flex-shrink: 0;
    width: 58px;
    height: 58px;
    background: #F2F3F6;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.mc-fe-item:hover .mc-fe-item-icon {
    background: #e8eaf0;
}

.mc-fe-item-icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
}

/* List view — smaller icon */
.mc-fe-items[data-view="list"] .mc-fe-item-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
}

.mc-fe-items[data-view="list"] .mc-fe-item-icon img {
    width: 24px;
    height: 24px;
}

/* ─────────────────────────────────────────────────────────────────
   Name & meta
───────────────────────────────────────────────────────────────── */

.mc-fe-item-name {
    font-weight: 400;
    font-size: 15px;
    color: #222C60;
    line-height: 1.35;
    transition: color 0.2s ease;
    word-break: break-word;
    font-family: inherit;
}

/* Grid — truncate to 2 lines */
.mc-fe-items[data-view="grid"] .mc-fe-item-name {
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}

/* List — single line truncate */
.mc-fe-items[data-view="list"] .mc-fe-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mc-fe-item-meta {
    font-size: 12px;
    color: #888;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────
   Pagination
───────────────────────────────────────────────────────────────── */

.mc-fe-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 30px;
    font-family: inherit;
}

.mc-fe-pagination button {
    padding: 10px 22px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #222C60;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mc-fe-pagination button:hover:not(:disabled) {
    background: #222C60;
    color: #fff;
    border-color: #222C60;
}

.mc-fe-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mc-fe-page-info {
    font-size: 14px;
    color: #666;
    font-family: inherit;
}

/* ─────────────────────────────────────────────────────────────────
   Loading spinner
───────────────────────────────────────────────────────────────── */

.mc-fe-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.9);
    z-index: 5;
}

.mc-fe-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #F2F3F6;
    border-top-color: #222C60;
    border-radius: 50%;
    animation: mcfe-spin 0.75s linear infinite;
}

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

/* ─────────────────────────────────────────────────────────────────
   Empty / no results
───────────────────────────────────────────────────────────────── */

.mc-fe-empty,
.mc-fe-no-results {
    padding: 32px 0;
    color: #888;
    font-size: 15px;
    font-family: inherit;
    text-align: center;
}

/* ─────────────────────────────────────────────────────────────────
   Utility
───────────────────────────────────────────────────────────────── */

.mc-fe-hidden {
    display: none !important;
}

/* ─────────────────────────────────────────────────────────────────
   Responsive
───────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .mc-fe-items[data-view="grid"][data-columns="4"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .mc-fe-items[data-view="grid"][data-columns="3"],
    .mc-fe-items[data-view="grid"][data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .mc-fe-items[data-view="grid"][data-columns="2"],
    .mc-fe-items[data-view="grid"][data-columns="3"],
    .mc-fe-items[data-view="grid"][data-columns="4"] {
        grid-template-columns: 1fr;
    }

    .mc-fe-pagination {
        gap: 10px;
    }

    .mc-fe-pagination button {
        padding: 8px 14px;
        font-size: 13px;
    }
}
