/* ============================================================
   picr.app – Main Stylesheet
   Bootstrap 3.3.7 + Custom – .NET 4.5 / VS 2013
   ============================================================ */

/* ---------- Variables (CSS3 custom properties) ---------- */
:root {
    --brand-blue:    #7c3aed;
    --brand-dark:    #1a1a2e;
    --brand-light:   #f8f9fa;
    --brand-accent:  #f97066;
    --card-radius:   10px;
    --shadow-sm:     0 2px 8px rgba(0,0,0,.12);
    --shadow-md:     0 6px 24px rgba(0,0,0,.18);
    --transition:    all .22s ease;
    --font-body:     'Nunito', sans-serif;
    --font-display:  'Playfair Display', Georgia, serif;
}

/* ---------- Base ---------- */
html, body {
    font-family: var(--font-body);
    background-color: #f0f2f5;
    color: #1a1a2e;
}

body {
    padding-top: 90px;   /* offset for fixed navbar */
}

a { color: var(--brand-blue); }
a:hover { color: #0c47a1; text-decoration: none; }

/* ---------- Navbar ---------- */
.navbar-custom {
    background: #ffffff;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
    min-height: 90px;
}

.navbar-custom .navbar-brand {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--brand-blue) !important;
    letter-spacing: -.3px;
    padding: 8px 15px;
}

.navbar-custom .navbar-brand img {
    height: 73px;
    vertical-align: middle;
}

.navbar-custom .navbar-brand .fa {
    color: var(--brand-accent);
    margin-right: 6px;
}

.navbar-custom .nav > li > a {
    font-weight: 600;
    font-size: 13px;
    color: #555;
    padding: 20px 16px;
    letter-spacing: .3px;
    transition: var(--transition);
}

.navbar-custom .nav > li > a:hover,
.navbar-custom .nav > li > a:focus {
    color: var(--brand-blue);
    background: transparent;
}

.navbar-custom .navbar-toggle { border-color: var(--brand-blue); }
.navbar-custom .icon-bar       { background-color: var(--brand-blue); }

/* ---------- Main wrapper ---------- */
.main-wrapper {
    min-height: calc(100vh - 110px);
}

/* ---------- Page Hero (album list header) ---------- */
.page-hero {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    color: #fff;
    padding: 42px 24px 32px;
    margin-bottom: 28px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -.5px;
}

.page-subtitle {
    font-size: 14px;
    opacity: .85;
    margin: 0;
}

/* ---------- Storage widget (in page-hero) ---------- */
.storage-widget {
    margin-top: 18px;
    max-width: 480px;
}

.storage-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    color: rgba(255,255,255,.9);
    font-size: 13px;
    margin-bottom: 7px;
    flex-wrap: wrap;
    gap: 4px;
}

.storage-numbers strong { color: #fff; }

.storage-sep {
    margin: 0 4px;
    opacity: .7;
}

.storage-pct {
    opacity: .75;
    font-size: 12px;
}

.storage-bar-track {
    height: 8px;
    background: rgba(255,255,255,.2);
    border-radius: 6px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width .6s ease;
    min-width: 2px;
}

.storage-bar-success { background: #34d399; }
.storage-bar-warning { background: #fbbf24; }
.storage-bar-danger  { background: #f87171; }

/* ---------- Gallery container ---------- */
.gallery-container {
    padding: 0 20px 40px;
}

/* ---------- Search row ---------- */
.search-row {
    margin-bottom: 22px;
}

.search-row .input-group .input-group-addon {
    background: #fff;
    border-right: 0;
    color: #999;
}

.search-row .form-control {
    border-left: 0;
    box-shadow: none;
}

/* ---------- Album Cards ---------- */
.album-col {
    margin-bottom: 24px;
}

.album-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.album-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* Cover image / Mosaic */
.album-cover-link { display: block; text-decoration: none; }

.album-cover {
    height: 200px;
    background-color: #dfe6ed;
    position: relative;
    overflow: hidden;
}

/* Mosaic tile system */
.album-mosaic {
    display: grid;
    gap: 2px;
    height: 200px;
}

.mosaic-tile {
    background-size: cover;
    background-position: center;
    min-width: 0;
    min-height: 0;
}

.mosaic-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    background: #edf2f7;
}

/* 1 photo: full cover */
.mosaic-1 { grid-template: 1fr / 1fr; }

/* 2 photos: side by side */
.mosaic-2 { grid-template: 1fr / 1fr 1fr; }

/* 3 photos: 1 large left, 2 stacked right */
.mosaic-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.mosaic-3 .mosaic-tile:first-child {
    grid-row: 1 / 3;
}

/* 4 photos: 2x2 grid */
.mosaic-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* 5 photos: 2 on top, 3 on bottom */
.mosaic-5 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.mosaic-5 .mosaic-tile:nth-child(1) { grid-column: 1 / 2; grid-row: 1; }
.mosaic-5 .mosaic-tile:nth-child(2) { grid-column: 2 / 4; grid-row: 1; }
.mosaic-5 .mosaic-tile:nth-child(3) { grid-column: 1 / 2; grid-row: 2; }
.mosaic-5 .mosaic-tile:nth-child(4) { grid-column: 2 / 3; grid-row: 2; }
.mosaic-5 .mosaic-tile:nth-child(5) { grid-column: 3 / 4; grid-row: 2; }

/* 6 photos: 3 on top, 3 on bottom */
.mosaic-6 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* 7 photos: 3 on top, 4 on bottom */
.mosaic-7 {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: 1fr 1fr;
}
.mosaic-7 .mosaic-tile:nth-child(1) { grid-column: 1 / 5; grid-row: 1; }
.mosaic-7 .mosaic-tile:nth-child(2) { grid-column: 5 / 9; grid-row: 1; }
.mosaic-7 .mosaic-tile:nth-child(3) { grid-column: 9 / 13; grid-row: 1; }
.mosaic-7 .mosaic-tile:nth-child(4) { grid-column: 1 / 4; grid-row: 2; }
.mosaic-7 .mosaic-tile:nth-child(5) { grid-column: 4 / 7; grid-row: 2; }
.mosaic-7 .mosaic-tile:nth-child(6) { grid-column: 7 / 10; grid-row: 2; }
.mosaic-7 .mosaic-tile:nth-child(7) { grid-column: 10 / 13; grid-row: 2; }

/* 0 photos: empty state */
.mosaic-0 { grid-template: 1fr / 1fr; }

.album-overlay {
    position: absolute; inset: 0;
    background: rgba(26,115,232,.65);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.album-card:hover .album-overlay { opacity: 1; }

.album-open-btn {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    border: 2px solid rgba(255,255,255,.8);
    padding: 8px 20px;
    border-radius: 30px;
}

.photo-count-badge {
    position: absolute;
    bottom: 10px; right: 10px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: .5px;
}

/* Album info */
.album-info {
    padding: 14px 16px;
}

.album-name {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-name a { color: #1a1a2e; }
.album-name a:hover { color: var(--brand-blue); }

.album-desc {
    font-size: 12px;
    color: #777;
    margin: 0 0 10px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.album-meta {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
}

.album-date { flex: 1; }

/* Icon action buttons */
.btn-icon {
    display: inline-block;
    width: 28px; height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    color: #aaa;
    font-size: 12px;
    transition: var(--transition);
    text-decoration: none;
}

.btn-icon:hover { color: var(--brand-blue); background: #e8f0fe; }
.btn-icon.btn-delete:hover { color: #e53935; background: #fce4e4; }

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #aaa;
}

.empty-icon { font-size: 72px; margin-bottom: 16px; opacity: .4; }

.empty-state h3 { color: #888; font-weight: 600; }

/* ---------- Album Page Hero ---------- */
.album-page-hero {
    background-size: cover;
    background-position: center;
    background-color: #1a2035;
    min-height: 260px;
    display: flex;
    align-items: flex-end;
    margin-bottom: 28px;
    position: relative;
}

.hero-overlay {
    background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.3) 70%, transparent 100%);
    width: 100%;
    padding: 32px 24px 28px;
}

.back-link {
    color: rgba(255,255,255,.8) !important;
    font-size: 13px;
    padding: 0;
    margin-bottom: 12px;
    display: block;
}

.back-link:hover { color: #fff !important; }

.hero-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: #fff;
    font-weight: 700;
    margin: 0 0 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,.4);
}

.hero-desc {
    color: rgba(255,255,255,.8);
    margin: 0 0 8px;
    font-size: 14px;
}

.hero-meta {
    color: rgba(255,255,255,.7);
    font-size: 13px;
    margin-bottom: 14px;
}

.btn-light-ghost {
    background: transparent;
    border: 2px solid rgba(255,255,255,.75);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    border-radius: 25px;
    padding: 7px 20px;
    transition: var(--transition);
}

.btn-light-ghost:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
    border-color: #fff;
}

/* ---------- Photos Toolbar ---------- */
.photos-toolbar {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.view-switcher .btn {
    padding: 5px 12px;
    font-size: 13px;
}

/* ---------- Justified Collage Grid ----------
   JS calculates each item's exact width & height so every row:
     • shares the same row height
     • fills the full container width
     • images scale proportionally — no distortion, no fixed height cap
   ------------------------------------------------------------ */
.collage-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-content: flex-start;
    padding: 0;
}

.collage-item {
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    /* flex-basis and height are set per-item by JS */
}

/* Clickable image cell */
.collage-img-wrap {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    line-height: 0;
}

/* Image fills cell — object-fit: cover keeps proportions */
.collage-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}

.collage-item:hover .collage-img { transform: scale(1.05); }

/* ── Hover overlay ── */
.collage-hover {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0)    35%,
        rgba(0,0,0,.78) 100%
    );
    opacity: 0;
    transition: opacity .22s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    pointer-events: none;
}

.collage-item:hover .collage-hover { opacity: 1; }
.collage-hover .ch-actions         { pointer-events: auto; }

.ch-top {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    color: #fff;
    font-size: 30px;
    text-shadow: 0 2px 10px rgba(0,0,0,.55);
}

.ch-bottom { flex-shrink: 0; }

.ch-title {
    display: block;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.ch-actions { display: flex; gap: 4px; }

.ch-actions .btn-icon {
    width: 28px; height: 28px;
    line-height: 28px; font-size: 12px;
    color: rgba(255,255,255,.9);
    background: rgba(0,0,0,.42);
    border-radius: 50%;
    text-decoration: none;
    text-align: center;
    display: inline-block;
    transition: background .2s;
}

.ch-actions .btn-icon:hover             { background: rgba(26,115,232,.82); color: #fff; }
.ch-actions .btn-icon.btn-delete:hover  { background: rgba(211,47,47,.82);  color: #fff; }

/* ── List-view info bar (hidden in collage mode) ── */
.collage-list-info { display: none; }

/* ---------- List View ---------- */
.collage-grid.list-view {
    flex-direction: column;
    gap: 5px;
}

.collage-grid.list-view .collage-item {
    display: flex !important;
    align-items: center;
    background: #fff;
    border-radius: 7px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    width: 100% !important;
    height: 68px !important;
    flex-basis: auto !important;
}

.collage-grid.list-view .collage-img-wrap {
    width: 68px !important;
    height: 68px !important;
    flex-shrink: 0;
    cursor: pointer;
}

.collage-grid.list-view .collage-img {
    width: 68px !important;
    height: 68px !important;
    object-fit: cover;
    transform: none !important;
}

.collage-grid.list-view .collage-hover { display: none; }

.collage-grid.list-view .collage-list-info {
    display: flex;
    align-items: center;
    flex: 1;
    padding: 0 14px;
    gap: 8px;
    overflow: hidden;
    min-width: 0;
}

.cli-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.cli-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* ---------- Upload Dropzone ---------- */
.upload-dropzone {
    border: 2px dashed #b0c4de;
    border-radius: 10px;
    background: #f5f8ff;
    text-align: center;
    padding: 36px 20px;
    color: #7a9cc8;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--brand-blue);
    background: #e8f0fe;
    color: var(--brand-blue);
}

.upload-dropzone p { margin: 10px 0 0; font-size: 13px; }
.upload-limit-hint { display: block; font-size: 11px; opacity: .7; margin-top: 4px; }

.upload-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* File preview list */
.file-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    background: #f1f3f5;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: #555;
    gap: 6px;
    max-width: 160px;
}

.file-preview-item img {
    width: 28px; height: 28px;
    object-fit: cover;
    border-radius: 4px;
}

.file-preview-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Lightbox ---------- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.92);
}

.lightbox-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img-wrap {
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
    position: relative;
}

.lightbox-img-wrap img {
    max-width: 88vw;
    max-height: 80vh;
    border-radius: 6px;
    box-shadow: 0 10px 60px rgba(0,0,0,.6);
    object-fit: contain;
}

.lightbox-caption {
    color: rgba(255,255,255,.75);
    font-size: 13px;
    margin-top: 12px;
}

.lightbox-close {
    position: absolute;
    top: 18px; right: 20px;
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    width: 42px; height: 42px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    z-index: 1;
}

.lightbox-close:hover { background: rgba(255,255,255,.25); }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    width: 48px; height: 48px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    z-index: 1;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-nav:hover { background: rgba(255,255,255,.28); }

.lightbox-download-hires {
    position: absolute;
    bottom: -46px;
    left: 0;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background .2s;
    z-index: 1;
}
.lightbox-download-hires:hover { background: rgba(255,255,255,.28); }
.lightbox-download-hires:disabled { opacity: .5; cursor: wait; }

body.lightbox-open { overflow: hidden; }

/* ---------- Modals ---------- */
.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
}

.modal-header {
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    color: #fff;
    border-radius: 10px 10px 0 0;
    padding: 16px 20px;
}

.modal-header h4 { color: #fff; font-weight: 700; margin: 0; }
.modal-header .close { color: #fff; opacity: .8; font-size: 22px; }
.modal-header .close:hover { opacity: 1; }

/* ---------- AdSense footer wrap ---------- */
.adsense-footer-wrap {
    max-width: 100%;
    padding: 10px 20px 0;
    background: #f0f2f5;
}

/* ---------- AdSense inline unit (inside page content) ---------- */
.adsense-inline-wrap {
    margin: 28px 0 12px;
    padding: 12px 16px;
    background: #f8f9fb;
    border: 1px solid #e8eaf0;
    border-radius: 8px;
    text-align: center;
}
.adsense-label {
    font-size: 10px;
    color: #aaa;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin: 0 0 6px;
}

/* ---------- Footer ---------- */
.site-footer {
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 20px 0 16px;
    margin-top: 0;
    color: #999;
    font-size: 12px;
}

.footer-links {
    margin-bottom: 8px;
}

.footer-links a {
    color: #666;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: color .2s;
}

.footer-links a:hover { color: var(--brand-blue); }

.footer-sep {
    margin: 0 8px;
    color: #ccc;
}

.footer-copy { margin: 0; }

/* ---------- Policy / Static pages ---------- */
.policy-hero {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    color: #fff;
    padding: 48px 24px 36px;
    margin-bottom: 0;
}

.policy-hero h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 10px;
}

.policy-hero .lead {
    font-size: 15px;
    opacity: .88;
    margin: 0;
}

.policy-body {
    padding: 40px 15px 60px;
}

.policy-section {
    margin-bottom: 40px;
}

.policy-section h2 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a2e;
    border-bottom: 2px solid #e8f0fe;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.policy-section h4 {
    font-weight: 700;
    color: #333;
    margin-top: 18px;
    margin-bottom: 8px;
}

.policy-section p {
    color: #444;
    line-height: 1.75;
    margin-bottom: 12px;
}

.policy-notice {
    margin-bottom: 32px;
    font-size: 13px;
}

.styled-list {
    color: #444;
    line-height: 1.75;
    padding-left: 22px;
    margin-bottom: 12px;
}

.styled-list li { margin-bottom: 6px; }

/* About page feature cards */
.feature-grid { margin-top: 10px; }

.feature-card {
    background: #f8f9ff;
    border: 1px solid #e0eaff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    height: 100%;
}

.feature-icon {
    font-size: 28px;
    color: var(--brand-blue);
    margin-bottom: 10px;
    display: block;
}

.feature-card h4 {
    font-weight: 700;
    margin: 0 0 8px;
    color: #1a1a2e;
}

.feature-card p {
    font-size: 13px;
    color: #666;
    margin: 0;
}

/* Contact page */
.contact-form { margin-top: 10px; }

.contact-info-grid { margin-top: 10px; }

.contact-info-card {
    text-align: center;
    padding: 24px 16px;
    background: #f8f9ff;
    border: 1px solid #e0eaff;
    border-radius: 10px;
    margin-bottom: 20px;
}

.contact-info-icon {
    font-size: 30px;
    color: var(--brand-blue);
    margin-bottom: 10px;
    display: block;
}

.contact-info-card h4 {
    font-weight: 700;
    margin: 0 0 6px;
}

.contact-info-card p {
    margin: 0 0 4px;
    font-weight: 600;
    color: #333;
}

.contact-info-card small { color: #999; }

/* FAQ */
.faq-list { margin-top: 10px; }

.faq-item {
    border-bottom: 1px solid #eef0f3;
    padding: 16px 0;
}

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

.faq-q {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
}

.faq-q .fa { color: var(--brand-blue); margin-right: 6px; }

.faq-a {
    margin: 0;
    color: #555;
    font-size: 13px;
    line-height: 1.7;
    padding-left: 22px;
}

/* ---------- Alerts ---------- */
.alert { border-radius: 8px; font-size: 13px; border: none; }
.alert-success { background: #e6f4ea; color: #1e7e34; }
.alert-danger   { background: #fce8e6; color: #c62828; }

/* ---------- Hero button row ---------- */
.hero-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-danger-ghost {
    background: transparent;
    border: 2px solid rgba(255,100,100,.75);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    border-radius: 25px;
    padding: 7px 20px;
    transition: var(--transition);
    display: inline-block;
    text-decoration: none;
}

.btn-danger-ghost:hover,
.btn-danger-ghost:focus {
    background: rgba(211,47,47,.75);
    color: #fff;
    border-color: transparent;
    text-decoration: none;
}

/* Push delete button to far right in hero row */
.hero-btn-delete { margin-left: auto; }

/* ---------- QR Code Modal ---------- */
#qrCodeBox {
    display: flex;
    justify-content: center;
    padding: 16px 0 8px;
}
#qrCodeBox canvas,
#qrCodeBox img { border-radius: 6px; }

.qr-link-wrap {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}
.qr-link-wrap input[type="text"] {
    flex: 1;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: 6px 10px;
    background: #f8f9fa;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btn-copy-qr {
    white-space: nowrap;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 6px;
}

.qr-expiry {
    text-align: center;
    font-size: 12px;
    color: #888;
    margin-top: 10px;
}
.qr-expiry i { margin-right: 4px; }

/* ---------- Selection Mode ---------- */
.selection-bar {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.sel-info {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    min-width: 120px;
}

.sel-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Checkbox overlay on each photo */
.sel-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.85);
    font-size: 15px;
    opacity: 0;
    transition: opacity .15s ease, background .15s ease;
    pointer-events: none;
}

.collage-grid.select-mode .sel-checkbox {
    opacity: 1;
    pointer-events: auto;
}

.collage-grid.select-mode .collage-item:hover .sel-checkbox {
    background: rgba(26,115,232,.7);
}

.collage-grid.select-mode .collage-item.selected .sel-checkbox {
    background: var(--brand-blue);
    color: #fff;
    opacity: 1;
}

.collage-grid.select-mode .collage-item.selected .collage-img {
    opacity: .6;
}

.collage-grid.select-mode .collage-hover { display: none; }
.collage-grid.select-mode .cli-actions   { visibility: hidden; }

.collage-grid.select-mode .collage-img-wrap { cursor: pointer; }
.collage-grid.list-view.select-mode .collage-item { cursor: pointer; }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 767px) {
    .page-hero { padding: 28px 16px 22px; }
    .hero-title { font-size: 1.5rem; }
    .album-cover, .album-mosaic { height: 160px; }
    .lightbox-nav { width: 36px; height: 36px; font-size: 16px; }
}

/* ============================================================
   Plan / Upgrade styles
   ============================================================ */

/* Inline Pro badge next to storage label */
.plan-badge-inline {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .5px;
    vertical-align: middle;
    margin-left: 6px;
    text-transform: uppercase;
}
.plan-badge-pro-inline {
    background: linear-gradient(135deg, #5c67f2, #8b5cf6);
    color: #fff;
}

/* Upgrade link inside storage widget */
.storage-upgrade-link {
    display: inline-block;
    margin-left: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #5c67f2;
    text-decoration: none;
    border: 1px solid #5c67f2;
    border-radius: 20px;
    padding: 1px 8px;
    transition: background .15s, color .15s;
}
.storage-upgrade-link:hover {
    background: #5c67f2;
    color: #fff;
    text-decoration: none;
}
.storage-upgrade-link:empty { display: none; }

/* Upgrade CTA block below storage bar */
.storage-upgrade-cta {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.btn-upgrade-cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #7c6de8 0%, #5c67f2 100%);
    color: #fff;
    border: none;
    border-radius: 22px;
    padding: 8px 22px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 3px 12px rgba(92,103,242,.4);
    transition: opacity .15s, transform .15s;
    white-space: nowrap;
}
.btn-upgrade-cta:hover,
.btn-upgrade-cta:focus {
    opacity: .9;
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}
.btn-renew-cta {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 3px 12px rgba(217,119,6,.4);
}
.storage-upgrade-hint {
    font-size: 12px;
    color: rgba(255,255,255,.75);
    letter-spacing: .01em;
}

/* Upgrade button inside album hero */
.btn-upgrade-hero {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #7c6de8 0%, #5c67f2 100%);
    color: #fff;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 7px 18px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 3px 12px rgba(92,103,242,.45);
    transition: opacity .15s, transform .15s;
    white-space: nowrap;
}
.btn-upgrade-hero:hover,
.btn-upgrade-hero:focus {
    opacity: .9;
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

/* ── Global plan banner (top of page below navbar) ── */
.plan-global-banner {
    position: relative;
    z-index: 900;
    padding: 9px 0;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}
.plan-global-banner .container-fluid { position: relative; }
.plan-banner-warning { background: #fff3cd; color: #856404; border-bottom: 1px solid #ffc107; }
.plan-banner-danger  { background: #f8d7da; color: #842029; border-bottom: 1px solid #f5c2c7; }
.plan-banner-info    { background: #cff4fc; color: #055160; border-bottom: 1px solid #9eeaf9; }
.plan-banner-btn {
    display: inline-block;
    margin-left: 12px;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid currentColor;
    transition: all .15s;
}
.plan-banner-btn:hover { opacity: .8; text-decoration: none; }

/* ── Upgrade page container ── */
.upgrade-container {
    max-width: 1080px;
    margin: 40px auto 60px;
    padding: 0 20px;
}

/* ── Plan cards row ── */
.plan-cards-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 48px;
}

.plan-card {
    flex: 1 1 0;
    min-width: 240px;
    max-width: 340px;
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px 28px;
    box-shadow: 0 4px 20px rgba(0,0,0,.10);
    border: 2px solid transparent;
    transition: box-shadow .2s, border-color .2s;
    position: relative;
    display: flex;
    flex-direction: column;
}
.plan-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,.16); }
.plan-card-current { border-color: #5c67f2; }
.plan-card-pro { background: linear-gradient(160deg, #fff 60%, #f3f0ff 100%); }

.plan-badge-wrap {
    min-height: 26px;
    margin-bottom: 12px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.plan-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
}
.plan-badge-current { background: #e8eaff; color: #5c67f2; }
.plan-badge-pro     { background: linear-gradient(135deg, #5c67f2, #8b5cf6); color: #fff; }

.plan-icon {
    font-size: 38px;
    color: #aaa;
    margin-bottom: 10px;
}
.plan-icon-pro { color: #5c67f2; }

.plan-name {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 14px;
    color: #1a1a2e;
}

.plan-price {
    margin-bottom: 22px;
}
.plan-price-amount {
    font-size: 42px;
    font-weight: 900;
    color: #1a1a2e;
    line-height: 1;
}
.plan-price-period {
    font-size: 14px;
    color: #888;
    margin-left: 4px;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    flex: 1;
}
.plan-features li {
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.plan-features li:last-child { border-bottom: none; }

.btn-plan-upgrade {
    background: linear-gradient(135deg, #5c67f2, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    font-weight: 700;
    transition: opacity .2s, box-shadow .2s;
    margin-bottom: 10px;
}
.btn-plan-upgrade:hover {
    opacity: .9;
    box-shadow: 0 4px 14px rgba(92,103,242,.4);
    color: #fff;
}
.btn-plan-renew {
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
}
.btn-plan-renew:hover { box-shadow: 0 4px 14px rgba(14,165,233,.4); }
.btn-plan-current {
    background: #f0f0f0;
    color: #888;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: default;
    margin-bottom: 10px;
}

.plan-expiry-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    text-align: center;
}
.plan-expiry-grace  { color: #b45309; }
.plan-expiry-expired { color: #dc2626; }

.plan-stripe-note {
    font-size: 11px;
    color: #bbb;
    text-align: center;
    margin: 4px 0 0;
}

/* ── Payment result card ── */
.payment-result-card {
    background: #fff;
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
}

/* ── Upgrade FAQ ── */
.upgrade-faq {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
.upgrade-faq h4 {
    margin: 0 0 20px;
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
}
.upgrade-faq .faq-item {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid #f0f0f0;
}
.upgrade-faq .faq-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.upgrade-faq .faq-item strong { display: block; margin-bottom: 4px; color: #1a1a2e; }
.upgrade-faq .faq-item p { margin: 0; color: #555; font-size: 14px; }

/* ── Responsive ── */
@media (max-width: 780px) {
    .plan-cards-row { flex-wrap: wrap; }
    .plan-card { flex: 1 1 280px; max-width: 100%; }
    .upgrade-container { margin: 24px auto 40px; }
}
