* {
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

body {
    background-color: #f2f2f7;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Constrain content width on panel pages only */
#content .panel-container {
    max-width: 600px;
    padding: 0;
}

/* ── Navbar ── */
.navbar {
    background-color: #fff !important;
    border-bottom: 1px solid #e0e0e5;
    margin-bottom: 0 !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1c1c1e;
}

/* ── Home page wrapper ── */
.home-wrap {
    padding: 24px 0;
}

/* ── Info block list ── */
.info-list {
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.info-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #f0f0f4;
    color: #1c1c1e;
    min-height: 56px;
    transition: background-color 0.15s;
}

.info-card:last-child {
    border-bottom: none;
}

.info-card:active {
    background-color: #f2f2f7;
}

.info-card__title {
    font-size: 1rem;
    font-weight: 500;
    flex: 1;
}

.info-card__chevron {
    font-size: 1.4rem;
    color: #c7c7cc;
    line-height: 1;
    margin-left: 8px;
}

.info-empty {
    padding: 40px 18px;
    text-align: center;
    color: #8e8e93;
    font-size: 0.95rem;
}

/* ── Info block detail ── */
.block-detail {
    padding: 20px 0;
}

.block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.block-header .block-detail__back {
    margin-bottom: 0;
}

.block-edit-btn {
    background: none;
    border: none;
    color: #007aff;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 0;
    -webkit-tap-highlight-color: transparent;
}

.block-detail__back {
    display: inline-block;
    font-size: 1rem;
    color: #007aff;
    margin-bottom: 20px;
    padding: 4px 0;
    /* reset button defaults so it works on both <a> and <button> */
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.block-detail__title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1c1c1e;
    margin-bottom: 16px;
    line-height: 1.25;
}

.block-detail__content {
    background: #fff;
    border-radius: 12px;
    padding: 16px 18px;
    font-size: 1rem;
    color: #3a3a3c;
    line-height: 1.6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    white-space: pre-wrap;
}

.block-detail__empty {
    color: #8e8e93;
    margin: 0;
}

/* ── File list ── */
.file-list-wrap {
    margin-top: 20px;
}

.file-list {
    list-style: none;
    margin: 0 0 2px;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.file-item {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f0f0f4;
    padding: 0 10px;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item__btn {
    display: flex;
    align-items: center;
    flex: 1;
    padding: 14px 10px;
    background: none;
    border: none;
    text-align: start;
    cursor: pointer;
    min-height: 56px;
    color: #1c1c1e;
    -webkit-tap-highlight-color: transparent;
}

.file-item__btn:active {
    background-color: #f2f2f7;
}

.file-item__icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: #8e8e93;
    margin-inline-end: 12px;
}

.file-item__icon svg {
    width: 100%;
    height: 100%;
}

.file-item__name {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    word-break: break-all;
}

.file-item__chevron {
    font-size: 1.4rem;
    color: #c7c7cc;
    line-height: 1;
    margin-left: 6px;
}

.file-item__edit-btn {
    width: 30px;
    background: none;
    border: none;
    color: #c7c7cc;
    cursor: pointer;
    padding: 8px 10px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.file-item__edit-btn svg {
    width: 16px;
    height: 16px;
}

.file-item__edit-btn:active {
    color: #007aff;
}

.file-item__delete-form {
    margin: 0;
    padding: 0;
}

.file-item__delete {
    width: 30px;
    background: none;
    border: none;
    color: #c7c7cc;
    font-size: 1rem;
    cursor: pointer;
    padding: 8px 10px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.file-item__delete:active {
    color: #dc3545;
}

.file-list__empty {
    padding: 32px 18px;
    text-align: center;
    color: #8e8e93;
    font-size: 0.95rem;
    margin: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ── User / admin badges ── */
.user-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.02em;
}

.user-badge--admin {
    background: #007aff18;
    color: #007aff;
}

.user-badge--you {
    background: #f2f2f7;
    color: #8e8e93;
}

/* ── Permission checkbox (admin toggle) ── */
.user-permission-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 0 2px;
}

.user-permission-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #007aff;
    flex-shrink: 0;
}

.user-permission-text {
    font-size: 1rem;
    color: #1c1c1e;
}

/* ── Permission grid ── */
.perm-grid-wrap {
    background: #f2f2f7;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.perm-grid-wrap.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.perm-section {
    margin-bottom: 10px;
}

.perm-section:last-child {
    margin-bottom: 0;
}

.perm-section__label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.perm-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.perm-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 4px;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 500;
    color: #3a3a3c;
    -webkit-tap-highlight-color: transparent;
}

.perm-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #007aff;
    cursor: pointer;
    margin: 0;
}

.perm-item input[type="checkbox"]:disabled {
    opacity: 0.4;
}

/* ── Upload button ── */
.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    background: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-size: 0.95rem;
    font-weight: 500;
    color: #007aff;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.upload-btn:active {
    background-color: #f2f2f7;
}

.upload-btn svg {
    width: 18px;
    height: 18px;
    stroke: #007aff;
}

/* ── Upload panel ── */
.upload-panel {
    margin-top: 12px;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.file-pick-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px dashed #c7c7cc;
    border-radius: 10px;
    cursor: pointer;
    color: #007aff;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 14px;
    -webkit-tap-highlight-color: transparent;
}

.file-pick-label:active {
    background: #f2f2f7;
}

.file-pick-label svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: #007aff;
}

.upload-field-group {
    margin-bottom: 12px;
}

.upload-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.upload-label__optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.upload-input,
.upload-textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid #e5e5ea;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    color: #1c1c1e;
    background: #fafafa;
    outline: none;
    resize: vertical;
}

.upload-input:focus,
.upload-textarea:focus {
    border-color: #007aff;
    background: #fff;
}

.upload-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.upload-cancel-btn,
.upload-submit-btn {
    flex: 1;
    padding: 13px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.upload-cancel-btn {
    background: #f2f2f7;
    color: #3a3a3c;
}

.upload-cancel-btn:active {
    background: #e5e5ea;
}

.upload-submit-btn {
    background: #007aff;
    color: #fff;
}

.upload-submit-btn:active {
    background: #0062cc;
}

.upload-submit-btn:disabled {
    background: #c7c7cc;
    cursor: not-allowed;
}

/* ── Preview ── */
.hidden {
    display: none !important;
}

.preview-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1c1c1e;
    margin-bottom: 14px;
    word-break: break-word;
}

.preview-desc {
    font-size: 0.9rem;
    color: #8e8e93;
    margin-top: -10px;
    margin-bottom: 14px;
    word-break: break-word;
    line-height: 1.5;
    white-space: pre-wrap;
}

.preview-container {
    width: 100%;
}

.preview-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.preview-pdf {
    width: 100%;
    height: calc(100vh - 160px);
    border: none;
    border-radius: 12px;
    display: block;
}

/* ── Section label (PDFs / Images / Folders) ── */
.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 2px;
    margin: 20px 0 8px;
}

.file-list-wrap > .section-label:first-child {
    margin-top: 0;
}

/* ── Breadcrumb ── */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 14px;
    font-size: 0.88rem;
}

.breadcrumb-link {
    color: #007aff;
    padding: 2px 0;
}

.breadcrumb-sep {
    color: #c7c7cc;
    margin: 0 3px;
    line-height: 1;
}

.breadcrumb-current {
    color: #8e8e93;
    font-weight: 500;
}

/* ── Folder icon (blue) ── */
.folder-icon {
    color: #007aff;
}

/* ── Large-screen preview breakout ── */
@media (min-width: 700px) {
    #preview-section {
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        width: min(92vw, 1200px);
    }
    [dir="rtl"] #preview-section {
        left: auto;
        right: 50%;
        transform: translateX(50%);
    }
    .preview-pdf {
        height: calc(100vh - 140px);
    }
}
