/* DGA File Manager - Public Frontend
   Modern, clean design aligned with DGA branding
   Primary: #1a3e6f (DGA Navy)  Accent: #2271b1  Success: #00a32a
*/

/* ===== Container ===== */
.dga-fm-public {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    width: 100%;
    max-width: 100%;
    color: #1d2327;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}
.dga-fm-public *, .dga-fm-public *::before, .dga-fm-public *::after {
    box-sizing: border-box;
}

/* ===== Header Bar ===== */
.dga-fm-pub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #1a3e6f 0%, #2271b1 100%);
    border-radius: 10px 10px 0 0;
    flex-wrap: wrap;
}

/* Breadcrumb */
.dga-fm-pub-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
    min-height: 32px;
}
.dga-fm-pub-breadcrumb a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.15s;
    white-space: nowrap;
}
.dga-fm-pub-breadcrumb a:hover {
    color: #fff;
}
.dga-fm-pub-breadcrumb .dga-fm-pub-bc-sep {
    color: rgba(255,255,255,0.4);
    font-size: 12px;
}
.dga-fm-pub-breadcrumb .dga-fm-pub-bc-current {
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}
.dga-fm-pub-breadcrumb .dga-fm-pub-bc-home svg {
    vertical-align: -2px;
    margin-right: 4px;
}

/* Search */
.dga-fm-pub-search {
    position: relative;
    flex-shrink: 0;
}
.dga-fm-pub-search input {
    padding: 7px 12px 7px 34px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    font-size: 13px;
    width: 220px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    outline: none;
    transition: all 0.2s;
    -webkit-appearance: none;
}
.dga-fm-pub-search input::placeholder {
    color: rgba(255,255,255,0.6);
}
.dga-fm-pub-search input:focus {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
}
.dga-fm-pub-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.6);
    pointer-events: none;
}

/* ===== Content ===== */
.dga-fm-pub-content {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 10px 10px;
    min-height: 200px;
    overflow: hidden;
}

/* ===== Table View ===== */
.dga-fm-pub-table {
    width: 100%;
    border-collapse: collapse;
}
.dga-fm-pub-table thead th {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    text-align: left;
    white-space: nowrap;
}
.dga-fm-pub-table thead th:nth-child(2),
.dga-fm-pub-table thead th:nth-child(3),
.dga-fm-pub-table thead th:last-child {
    text-align: right;
}
.dga-fm-pub-table tbody tr {
    transition: background 0.12s;
    cursor: pointer;
}
.dga-fm-pub-table tbody tr:hover {
    background: #f0f7ff;
}
.dga-fm-pub-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #f0f0f0;
}
.dga-fm-pub-table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 14px;
}

/* Name cell */
.dga-fm-pub-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.dga-fm-pub-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dga-fm-pub-icon.folder-icon {
    background: #FEF3C7;
    color: #D97706;
}
.dga-fm-pub-icon.file-icon {
    background: #EFF6FF;
    color: #2271b1;
}
.dga-fm-pub-icon svg {
    width: 20px;
    height: 20px;
}
.dga-fm-pub-icon img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
}
.dga-fm-pub-name-text {
    min-width: 0;
}
.dga-fm-pub-name-text .name {
    font-weight: 500;
    color: #1d2327;
    white-space: normal;
    word-break: break-word;
    display: block;
}
.dga-fm-pub-name-text .sub {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 1px;
}
.dga-fm-pub-lock {
    color: #d63638;
    flex-shrink: 0;
    display: flex;
}
.dga-fm-pub-lock svg {
    width: 14px;
    height: 14px;
}

/* Name column — expands to fill all remaining space */
.dga-fm-pub-table .col-name {
    width: 100%;
}

/* Size & download columns — auto-sized to content (white-space: nowrap handles it) */
.dga-fm-pub-table .col-size,
.dga-fm-pub-table .col-downloads {
    color: #6b7280;
    font-size: 13px;
    white-space: nowrap;
    text-align: right;
}
.dga-fm-pub-table .col-downloads {
    font-variant-numeric: tabular-nums;
}
.dga-fm-pub-table .col-action {
    white-space: nowrap;
    text-align: right;
}

/* Action/download button */
.dga-fm-pub-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: #2271b1;
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none !important;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}
.dga-fm-pub-dl-btn:hover {
    background: #135e96;
    color: #ffffff !important;
    text-decoration: none !important;
}
.dga-fm-pub-dl-btn:visited,
.dga-fm-pub-dl-btn:active {
    color: #ffffff !important;
}
.dga-fm-pub-dl-btn svg {
    width: 14px;
    height: 14px;
}

/* Folder row open indicator */
.dga-fm-pub-open-indicator {
    color: #9ca3af;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}
tr:hover .dga-fm-pub-open-indicator {
    color: #2271b1;
}
.dga-fm-pub-open-indicator svg {
    width: 14px;
    height: 14px;
}

/* ===== Table Footer (Summary) ===== */
.dga-fm-pub-table tfoot tr {
    background: #f9fafb;
    cursor: default;
}
.dga-fm-pub-table tfoot tr:hover {
    background: #f9fafb;
}
.dga-fm-pub-table tfoot td {
    padding: 10px 16px;
    border-top: 2px solid #e5e7eb;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    vertical-align: middle;
}
.dga-fm-pub-summary-label {
    color: #1a3e6f;
    font-weight: 600;
}

/* ===== Locked/Protected Folder ===== */
.dga-fm-pub-locked .dga-fm-pub-table {
    filter: blur(6px);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    opacity: 0.5;
}
.dga-fm-pub-locked .dga-fm-pub-empty {
    filter: blur(6px);
    pointer-events: none;
}

/* ===== Empty State ===== */
.dga-fm-pub-empty {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}
.dga-fm-pub-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dga-fm-pub-empty-icon svg {
    width: 28px;
    height: 28px;
    color: #d1d5db;
}
.dga-fm-pub-empty p {
    font-size: 15px;
    margin: 0;
}

/* ===== Loading ===== */
.dga-fm-pub-loading {
    text-align: center;
    padding: 48px 20px;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}
.dga-fm-pub-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: dga-fm-spin 0.7s linear infinite;
}
@keyframes dga-fm-spin {
    to { transform: rotate(360deg); }
}

/* ===== Password Modal ===== */
.dga-fm-pub-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.dga-fm-pub-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.dga-fm-pub-modal {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    width: 380px;
    max-width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    text-align: center;
    animation: dga-fm-modal-in 0.25s ease-out;
}
@keyframes dga-fm-modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.dga-fm-pub-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s;
    display: flex;
}
.dga-fm-pub-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}
.dga-fm-pub-modal-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D97706;
}
.dga-fm-pub-modal h3 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}
.dga-fm-pub-modal-desc {
    margin: 0 0 20px;
    font-size: 13px;
    color: #6b7280;
}
.dga-fm-pub-modal-input {
    margin-bottom: 12px;
}
.dga-fm-pub-modal-input input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    text-align: center;
    letter-spacing: 2px;
    -webkit-appearance: none;
}
.dga-fm-pub-modal-input input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,0.1);
}
.dga-fm-pub-modal-error {
    color: #dc2626;
    font-size: 13px;
    margin: 0 0 12px;
    padding: 8px 12px;
    background: #FEF2F2;
    border-radius: 8px;
}
.dga-fm-pub-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

/* ===== Buttons ===== */
.dga-fm-pub-btn {
    padding: 9px 24px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: #fff;
    color: #374151;
    transition: all 0.15s;
    outline: none;
}
.dga-fm-pub-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}
.dga-fm-pub-btn-primary {
    background: linear-gradient(135deg, #1a3e6f, #2271b1);
    color: #fff;
    border-color: transparent;
}
.dga-fm-pub-btn-primary:hover {
    background: linear-gradient(135deg, #152f54, #1a5e96);
    border-color: transparent;
}
.dga-fm-pub-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Responsive ===== */
@media screen and (max-width: 768px) {
    .dga-fm-pub-header {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px;
        gap: 10px;
    }
    .dga-fm-pub-search {
        width: 100%;
    }
    .dga-fm-pub-search input {
        width: 100%;
    }
    .dga-fm-pub-table thead {
        display: none;
    }
    .dga-fm-pub-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 4px 16px;
        align-items: center;
    }
    .dga-fm-pub-table tbody tr:not(:last-child) {
        border-bottom: 1px solid #f0f0f0;
    }
    .dga-fm-pub-table tbody tr:not(:last-child) td {
        border-bottom: none;
    }
    .dga-fm-pub-table tbody td {
        padding: 0;
    }
    .dga-fm-pub-table tbody td.col-name {
        flex: 1 1 100%;
        margin-bottom: 4px;
    }
    .dga-fm-pub-table tbody td.col-size,
    .dga-fm-pub-table tbody td.col-downloads {
        font-size: 12px;
    }
    .dga-fm-pub-table tbody td.col-action {
        margin-left: auto;
    }
    .dga-fm-pub-table tfoot tr {
        display: flex;
        flex-wrap: wrap;
        padding: 10px 16px;
        gap: 4px 16px;
        align-items: center;
    }
    .dga-fm-pub-table tfoot td {
        padding: 0;
        border-top: none;
    }
    .dga-fm-pub-table tfoot td.col-name {
        flex: 1 1 100%;
        border-top: 2px solid #e5e7eb;
        padding-top: 10px;
    }
    .dga-fm-pub-table tfoot td.col-action {
        display: none;
    }
    .dga-fm-pub-modal {
        padding: 24px 20px;
    }
}
@media screen and (max-width: 480px) {
    .dga-fm-pub-breadcrumb {
        font-size: 13px;
    }
    .dga-fm-pub-dl-btn span {
        display: none;
    }
}
