﻿/**
 * Kistenstein Club Document Portal – Frontend Styles
 *
 * @package kistenstein-club-document-portal
 */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.kcdp {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 100%;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    margin: 0 0 28px;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.kcdp-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: #f3f8f5;
    border-bottom: 1px solid #d0e4d8;
    flex-wrap: wrap;
}
.kcdp-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Search input ────────────────────────────────────────────────────────── */
.kcdp-search-input {
    font-size: 13px;
    padding: 5px 10px;
    border: 1px solid #b0d0bc;
    border-radius: 6px;
    outline: none;
    background: #fff;
    color: #1b4332;
    width: 140px;
    min-width: 80px;
    flex-shrink: 1;
    transition: border-color .15s;
}
.kcdp-search-input:focus { border-color: #2c6e49; width: 180px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.kcdp-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    text-decoration: none;
    transition: background .15s;
}
.kcdp-btn-pri { background: #2c6e49; color: #fff; }
.kcdp-btn-pri:hover { background: #1b4332; color: #fff; }
.kcdp-btn-sec { background: #fff; color: #2c6e49; border: 1px solid #b0d0bc; }
.kcdp-btn-sec:hover { background: #f0f9f4; }
.kcdp-btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Inline mkdir box ────────────────────────────────────────────────────── */
.kcdp-mkdir-box {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f3f8f5;
    border-bottom: 1px solid #d0e4d8;
    flex-wrap: wrap;
}
.kcdp-mkdir-box .kcdp-ri {
    flex: 1;
    min-width: 160px;
    max-width: 320px;
}

/* ── Inline confirm buttons ──────────────────────────────────────────────── */
.kcdp-confirm-yes {
    color: #fff !important;
    background: #dc2626 !important;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 13px;
    cursor: pointer;
}
.kcdp-confirm-yes:hover { background: #b91c1c !important; }
.kcdp-confirm-no {
    color: #374151 !important;
    background: #f3f4f6 !important;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid #d1d5db;
}
.kcdp-confirm-no:hover { background: #e5e7eb !important; }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.kcdp-bread {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    flex-wrap: wrap;
    min-height: 24px;
}
.kcdp-bi { color: #2c6e49; cursor: pointer; font-weight: 500; }
.kcdp-bi:hover { text-decoration: underline; }
.kcdp-bc { color: #9ab0a5; margin: 0 1px; }
.kcdp-bactive { color: #1b4332; font-weight: 600; cursor: default; }

/* ── Drop zone ───────────────────────────────────────────────────────────── */
.kcdp-dz {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    font-size: 13px;
    color: #7a9a8a;
    border-bottom: 2px dashed #c8dfd0;
    transition: all .15s;
}
.kcdp-dz-on {
    display: flex !important;
    background: #ecf9f2;
    color: #2c6e49;
    border-color: #2c6e49;
}

/* ── Status bar ──────────────────────────────────────────────────────────── */
.kcdp-status { font-size: 13px; }
.kcdp-status:not(:empty) { padding: 8px 14px; border-bottom: 1px solid #ecf3ef; }
.kcdp-status .ok { color: #2c6e49; }
.kcdp-status .er { color: #dc2626; }

/* ── Loading spinner ─────────────────────────────────────────────────────── */
.kcdp-spin { padding: 40px; text-align: center; color: #9ab0a5; font-size: 13px; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.kcdp-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; }
.kcdp-tbl th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}
.kcdp-c0  { width: 44px; }
.kcdp-cac { width: 44px; text-align: center; padding: 0 4px !important; vertical-align: middle !important; }
.kcdp-csz { width: 80px; }
.kcdp-cdt { width: 120px; }
.kcdp-cnm { overflow: hidden; }

/* ── Checkbox column ─────────────────────────────────────────────────────── */
.kcdp-tbl th.kcdp-c-chk,
.kcdp-tbl td.kcdp-c-chk {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    text-align: center;
    padding: 0 4px !important;
    box-sizing: content-box;
}
.kcdp-c-chk input[type="checkbox"] {
    cursor: pointer;
    accent-color: #2c6e49;
    width: 14px;
    height: 14px;
    display: block;
    margin: 0 auto;
}

/* ── Sortable column header ──────────────────────────────────────────────── */
.kcdp-th-sort {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.kcdp-th-sort:hover { color: #222; }
.kcdp-sort-ind {
    font-size: 10px;
    color: #444;
    margin-left: 2px;
}

.kcdp-row td {
    padding: 12px 14px;
    border-bottom: 1px solid #ebebeb;
    vertical-align: middle;
}
.kcdp-row:last-child td { border-bottom: none; }
.kcdp-row:hover td { background: #f5f5f5; }

/* ── File / folder names ─────────────────────────────────────────────────── */
/* ── Name cell wrapper (flex, truncation) ────────────────────────────────── */
.kcdp-nm-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}
.kcdp-fname,
.kcdp-dname {
    color: #222 !important;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-shrink: 1;
}
.kcdp-fname:hover,
.kcdp-dname:hover { color: #0082c9 !important; text-decoration: none !important; }
.kcdp-fext { font-size: 11px; color: #b0b0b0; flex-shrink: 0; }
.kcdp-csz,
.kcdp-cdt { font-size: 12px; color: #6b6b6b; }

/* ── Download count badge ────────────────────────────────────────────────── */
.kcdp-dl-cnt {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    font-weight: 600;
    color: #9ab0a5;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 1px 5px;
    vertical-align: middle;
    cursor: default;
}

/* ── File type badge ─────────────────────────────────────────────────────── */
.kcdp-badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .3px;
}
.kcdp-fico { color: #f59e0b; }

/* ── Row action icons (legacy, kept for trash/audit) ─────────────────────── */
.kcdp-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 1px solid transparent;
    cursor: pointer;
    background: transparent;
    color: #7a9a8a;
    vertical-align: middle;
    padding: 0;
    transition: all .15s;
    text-decoration: none;
}
.kcdp-act:hover { background: #f0f9f4; border-color: #c8dfd0; color: #2c6e49; }
.kcdp-del:hover { background: #fff0f0; border-color: #ffc9c9; color: #dc2626; }

/* ── Three-dot menu button ────────────────────────────────────────────────── */
.kcdp-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: #b0b0b0;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background .1s, color .1s, border-color .1s;
    vertical-align: middle;
}
.kcdp-menu-btn:hover,
.kcdp-menu-btn.kcdp-menu-btn-active {
    background: #ebebeb;
    border-color: #d5d5d5;
    color: #222;
}

/* ── Dropdown list (appended to <body>, absolute positioned) ─────────────── */
.kcdp-dropdown {
    position: absolute;
    z-index: 99999;
    min-width: 200px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15), 0 1px 4px rgba(0, 0, 0, .08);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow: hidden;
}
.kcdp-dd-sep {
    height: 1px;
    background: #ebebeb;
    margin: 4px 0;
}
.kcdp-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 14px;
    font-size: 14px;
    font-weight: 400;
    color: #222;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: background .08s;
    box-sizing: border-box;
}
.kcdp-dd-item:hover { background: #f5f5f5; color: #222; }
.kcdp-dd-danger { color: #b91c1c; }
.kcdp-dd-danger:hover { background: #fff0f0; color: #b91c1c; }
.kcdp-dd-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    flex-shrink: 0;
    opacity: .75;
}
.kcdp-dd-lbl { flex: 1; }
.kcdp-dd-info {
    font-size: 11px;
    color: #9ab0a5;
    font-weight: 400;
    white-space: nowrap;
}

/* ── Danger button (used in confirmDelete) ───────────────────────────────── */
.kcdp-btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
}
.kcdp-btn-danger:hover { background: #b91c1c; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.kcdp-empty { text-align: center; padding: 48px 20px; color: #9ab0a5; font-size: 14px; }

/* ── Inline rename input ─────────────────────────────────────────────────── */
.kcdp-ri {
    font-size: 14px;
    font-weight: 500;
    color: #1b4332;
    border: 1.5px solid #2c6e49;
    border-radius: 5px;
    padding: 2px 8px;
    outline: none;
    min-width: 140px;
    max-width: 100%;
    background: #fff;
}

/* ── Drag-and-drop move ──────────────────────────────────────────────────── */
.kcdp-row[draggable] { cursor: grab; }
.kcdp-row[draggable]:active { cursor: grabbing; }
.kcdp-dragging { opacity: .35; }
.kcdp-droptarget td {
    background: #ecf9f2 !important;
    outline: 2px solid #2c6e49;
    outline-offset: -2px;
}
.kcdp-bread-drop {
    background: #d4edda !important;
    border-radius: 4px;
    padding: 2px 6px !important;
    outline: 2px solid #2c6e49;
}

/* ── Bulk action bar ─────────────────────────────────────────────────────── */
.kcdp-bulk-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #fef9c3;
    border-bottom: 1px solid #fde047;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
.kcdp-bulk-label {
    font-size: 13px;
    font-weight: 600;
    color: #854d0e;
    flex: 1;
    white-space: nowrap;
}

/* ── Login notice ────────────────────────────────────────────────────────── */
.kcdp-login-notice { padding: 16px; color: #c0392b; font-size: 14px; }

/* ── Password box ────────────────────────────────────────────────────────── */
.kcdp-pwbox { margin-bottom: 20px; border-color: #e8dfc8; }
.kcdp-pwbox .kcdp-bar { background: #fdf8f0; border-color: #e8dfc8; }
.kcdp-pw-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.kcdp-pw-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kcdp-pw-label { font-size: 13px; color: #6b7280; white-space: nowrap; }
.kcdp-pw-val {
    font-family: monospace;
    font-size: 14px;
    font-weight: 600;
    color: #1b4332;
    background: #f0f9f4;
    border: 1px solid #c8dfd0;
    border-radius: 5px;
    padding: 4px 12px;
    min-width: 120px;
    letter-spacing: 1px;
}
.kcdp-pw-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Trash panel ─────────────────────────────────────────────────────────── */
.kcdp-trash .kcdp-bar { background: #fdf8f0; border-color: #f0e0c0; }
.kcdp-trash-path { font-size: 12px; color: #9ab0a5; font-family: monospace; }
.kcdp-trash-exp {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
}
.kcdp-exp-ok   { background: #f0f9f4; color: #2c6e49; }
.kcdp-exp-warn { background: #fef9ec; color: #d97706; }
.kcdp-exp-crit { background: #fff0f0; color: #dc2626; }
.kcdp-btn-restore {
    background: #2c6e49;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.kcdp-btn-restore:hover { background: #1b4332; }

/* ── Audit log ───────────────────────────────────────────────────────────── */
.kcdp-audit-wrap .kcdp-bar { background: #f0f4ff; border-color: #c7d2fe; }
.kcdp-audit-tbl th { background: #f8f9ff; }
.kcdp-audit-action {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    white-space: nowrap;
}
.kcdp-audit-act-download     { background: #dbeafe; color: #1d4ed8; }
.kcdp-audit-act-zip_download { background: #e0e7ff; color: #4338ca; }
.kcdp-audit-act-upload       { background: #dcfce7; color: #15803d; }
.kcdp-audit-act-rm           { background: #fee2e2; color: #b91c1c; }
.kcdp-audit-act-rmdir        { background: #fee2e2; color: #b91c1c; }
.kcdp-audit-act-mkdir        { background: #fef9c3; color: #854d0e; }
.kcdp-audit-act-rename       { background: #fef3c7; color: #92400e; }
.kcdp-audit-act-move         { background: #f3e8ff; color: #7e22ce; }
.kcdp-audit-act-restore      { background: #ecfdf5; color: #065f46; }
.kcdp-audit-act-purge        { background: #fef2f2; color: #991b1b; }

.kcdp-audit-folder {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-right: 4px;
}
.kcdp-audit-path {
    font-size: 12px;
    color: #9ca3af;
    font-family: monospace;
}
.kcdp-audit-pager {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    flex-wrap: wrap;
    border-top: 1px solid #e5e7eb;
}
.kcdp-audit-page-info {
    font-size: 12px;
    color: #9ab0a5;
    margin-right: 8px;
}
.kcdp-audit-page-active {
    background: #2c6e49 !important;
    color: #fff !important;
    border-color: #2c6e49 !important;
}

/* ── PDF preview modal ───────────────────────────────────────────────────── */
#kcdp-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.kcdp-mbox {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 960px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .35);
}
.kcdp-mhd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
    gap: 12px;
}
.kcdp-mttl {
    font-size: 14px;
    font-weight: 600;
    color: #1b4332;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kcdp-mclose {
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    padding: 2px 6px;
}
.kcdp-mclose:hover { color: #111; }
.kcdp-mbody { flex: 1; overflow: hidden; }
#kcdp-mframe { width: 100%; height: 100%; border: none; display: block; }

/* ── Detail panel (slides in from right) ─────────────────────────────────── */
#kcdp-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, .1);
    z-index: 99998;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform .22s ease;
    box-sizing: border-box;
}
#kcdp-detail-panel.kcdp-detail-open { transform: translateX(0); }
.kcdp-detail-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #ebebeb;
    background: #fafafa;
}
.kcdp-detail-title { font-size: 14px; font-weight: 600; color: #222; }
.kcdp-detail-close {
    background: transparent; border: none; cursor: pointer;
    font-size: 16px; color: #888; padding: 2px 6px; border-radius: 4px;
    line-height: 1;
}
.kcdp-detail-close:hover { background: #ebebeb; color: #222; }
.kcdp-detail-ico-wrap {
    display: flex;
    justify-content: center;
    padding: 28px 0 12px;
}
.kcdp-detail-fname {
    text-align: center;
    padding: 0 16px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #222;
    word-break: break-word;
    line-height: 1.4;
}
.kcdp-detail-val-name {
    word-break: break-all;
    font-size: 13px;
}
.kcdp-detail-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    padding: 0 16px;
}
.kcdp-detail-tbl th {
    text-align: left;
    font-weight: 600;
    color: #6b6b6b;
    padding: 8px 16px 8px 16px;
    white-space: nowrap;
    width: 90px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.kcdp-detail-tbl td {
    padding: 8px 16px 8px 0;
    color: #222;
    border-bottom: 1px solid #f0f0f0;
    word-break: break-word;
}
.kcdp-detail-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: #f0f0f0;
    min-height: 80px;
}
.kcdp-detail-preview img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    display: block;
}
.kcdp-meta-sep {
    padding: 12px 16px 4px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: #6b6b6b;
    background: #fafafa;
    border-top: 2px solid #ebebeb;
    border-bottom: none !important;
}
.kcdp-meta-loading {
    padding: 10px 16px !important;
    font-size: 12px !important;
    color: #999;
    font-style: italic;
    border-bottom: none !important;
}

/* ── Responsive adjustments ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    .kcdp-cdt { display: none; }
    .kcdp-csz { display: none; }
    .kcdp-search-input { min-width: 100px; }
    #kcdp-detail-panel { width: 100%; }
}
