:root {
    --black: #070707;
    --panel: #11110f;
    --gold: #dfb34f;
    --text: #f4f0e8;
    --muted: #a9a59b;
    --green: #58c873;
}

* { box-sizing: border-box; }

html {
    min-height: 100%;
    background: var(--black);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 50% 0%, #242018 0%, #0c0c0b 38%, #050505 75%);
    font-family: Arial, Helvetica, sans-serif;
}

button, input { font: inherit; }

.login-page {
    display: grid;
    place-items: center;
    padding: 30px 18px;
}

.login-card {
    width: min(520px, 100%);
    padding: 42px 44px;
    text-align: center;
    border: 1px solid rgba(223, 179, 79, 0.42);
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(25,24,21,.98), rgba(7,7,7,.99));
    box-shadow: 0 35px 100px rgba(0,0,0,.65);
}

.login-monogram, .brand-monogram {
    display: grid;
    place-items: center;
    border: 1px solid var(--gold);
    border-radius: 50%;
    color: var(--gold);
    font-family: Georgia, serif;
}

.login-monogram {
    width: 78px;
    height: 78px;
    margin: 0 auto 20px;
    font-size: 31px;
}

.login-card h1 {
    margin: 0;
    color: var(--gold);
    font-family: Georgia, serif;
    font-size: clamp(36px, 8vw, 54px);
    font-weight: 400;
}

.mission, .brand-mission {
    color: var(--gold);
    font-family: Georgia, serif;
    letter-spacing: 3px;
}

.mission {
    margin: 14px 0 10px;
    font-size: 11px;
}

.login-signature {
    width: min(330px, 85%);
    margin: 8px auto 0;
}

.gold-line {
    height: 1px;
    margin: 24px 0 28px;
    background: linear-gradient(90deg, transparent, rgba(223,179,79,.8), transparent);
}

.login-card h2 {
    margin: 0 0 23px;
    font-family: Georgia, serif;
    font-weight: 400;
}

.login-form {
    display: grid;
    gap: 10px;
    text-align: left;
}

.login-form label {
    margin-top: 4px;
    color: #d9d4ca;
    font-size: 13px;
}

.login-form input {
    width: 100%;
    padding: 14px 15px;
    border: 1px solid #403a2b;
    border-radius: 10px;
    outline: none;
    color: var(--text);
    background: #0c0c0b;
}

.login-form input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(223,179,79,.1);
}

.login-form button {
    margin-top: 14px;
    padding: 15px;
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    color: #171107;
    background: linear-gradient(135deg, #f1c865, #c58f26);
    font-family: Georgia, serif;
    font-size: 18px;
}

.login-error {
    margin-bottom: 17px;
    padding: 11px;
    border: 1px solid rgba(217,88,88,.45);
    border-radius: 9px;
    color: #ffaaaa;
    background: rgba(217,88,88,.08);
    font-size: 14px;
}

.secure-note {
    margin: 25px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.dashboard-page { background: #070707; }

.topbar {
    min-height: 124px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 30px;
    border-bottom: 1px solid #302614;
    background: linear-gradient(90deg, #090909, #11110f, #080808);
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-monogram {
    width: 67px;
    height: 67px;
    flex: 0 0 auto;
    font-size: 26px;
}

.brand-name {
    color: var(--gold);
    font-family: Georgia, serif;
    font-size: 29px;
}

.brand-mission {
    margin-top: 3px;
    font-size: 8px;
}

.brand-signature {
    display: block;
    width: 154px;
    margin-top: 4px;
}

.admin-area {
    display: flex;
    align-items: center;
    gap: 17px;
    color: #ddd8ce;
}

.logout-button {
    padding: 9px 13px;
    border: 1px solid #6f531e;
    border-radius: 8px;
    cursor: pointer;
    color: var(--gold);
    background: transparent;
}

.dashboard-layout {
    min-height: calc(100vh - 124px);
    display: grid;
    grid-template-columns: 275px 1fr;
}

.sidebar {
    padding: 21px 17px;
    border-right: 1px solid #302614;
    background: linear-gradient(180deg, #0d0d0c, #090909);
}

.nav-item {
    display: block;
    margin-bottom: 8px;
    padding: 16px 17px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #ddd9d0;
    text-decoration: none;
    font-family: Georgia, serif;
}

.nav-item:hover, .nav-item.active {
    border-color: #5f481b;
    color: var(--gold);
    background: linear-gradient(90deg, rgba(223,179,79,.12), transparent);
}

.admin-link {
    margin-top: 28px;
    border-color: #41351e;
}

.content {
    min-width: 0;
    padding: 28px;
    background: radial-gradient(circle at top right, #17140e 0%, #090909 35%, #070707 70%);
}

.welcome-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.welcome-row h1 {
    margin: 0;
    font-family: Georgia, serif;
    font-size: 36px;
    font-weight: 400;
}

.welcome-row p {
    margin: 8px 0 0;
    color: var(--muted);
}

.server-status {
    padding: 11px 16px;
    border: 1px solid #4a3a1c;
    border-radius: 999px;
    color: #d8d1c5;
    font-size: 13px;
}

.server-status span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 10px var(--green);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(135px, 1fr));
    gap: 14px;
    margin-top: 25px;
}

.stat-card {
    min-height: 178px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border: 1px solid #4b3a19;
    border-radius: 15px;
    background: linear-gradient(145deg, #171612, #0e0e0d);
}

.stat-icon {
    margin-bottom: 12px;
    color: var(--gold);
    font-size: 28px;
}

.stat-card strong {
    font-family: Georgia, serif;
    font-size: 31px;
    font-weight: 400;
}

.stat-card span {
    margin-top: 8px;
    color: #c5c1b8;
    text-align: center;
    font-size: 13px;
}

.dashboard-panels {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr);
    gap: 17px;
    margin-top: 17px;
}

.panel {
    min-height: 360px;
    padding: 20px;
    border: 1px solid #493818;
    border-radius: 15px;
    background: linear-gradient(145deg, #141411, #0c0c0b);
}

.panel-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 17px;
}

.panel-heading h2 {
    margin: 0;
    font-family: Georgia, serif;
    font-size: 21px;
    font-weight: 400;
}

.panel-heading span {
    color: var(--gold);
    font-size: 12px;
}

.empty-state {
    min-height: 270px;
    display: grid;
    place-content: center;
    text-align: center;
    color: var(--muted);
}

.empty-state.small { min-height: 250px; }

.empty-state h3 {
    margin: 12px 0 7px;
    color: #e0dcd2;
    font-family: Georgia, serif;
    font-weight: 400;
}

.empty-state p {
    max-width: 370px;
    margin: 0 auto;
    line-height: 1.55;
}

.empty-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin: auto;
    border: 1px solid var(--gold);
    border-radius: 50%;
    color: var(--gold);
    font-family: Georgia, serif;
}

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

.photo-placeholder {
    aspect-ratio: 4 / 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
    overflow: hidden;
    border: 1px solid #5c461b;
    border-radius: 11px;
    background: radial-gradient(circle at top, #49391e, #17130d 55%, #090909);
}

.photo-placeholder span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-placeholder small {
    margin-top: 4px;
    color: var(--muted);
}

.device-list { display: grid; }

.device-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 17px 2px;
    border-bottom: 1px solid #2f2b22;
}

.device-row strong, .device-row small { display: block; }

.device-row small {
    margin-top: 5px;
    color: var(--muted);
}

.device-active {
    color: var(--green);
    font-size: 12px;
}

.bottom-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 17px;
    padding: 19px 22px;
    border: 1px solid #493818;
    border-radius: 13px;
    background: #11110f;
}

.bottom-status strong, .bottom-status span { display: block; }

.bottom-status span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 1050px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .dashboard-panels { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .topbar { align-items: flex-start; padding: 16px; }
    .brand-name { font-size: 23px; }
    .brand-mission, .brand-signature { display: none; }
    .admin-area > span { display: none; }
    .dashboard-layout { display: block; }
    .sidebar {
        display: flex;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid #302614;
    }
    .nav-item {
        flex: 0 0 auto;
        margin: 0 6px 0 0;
        padding: 11px 13px;
    }
    .content { padding: 18px; }
    .welcome-row { align-items: flex-start; flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-card { min-height: 145px; }
    .photo-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 460px) {
    .login-card { padding: 31px 23px; }
    .stats-grid { grid-template-columns: 1fr; }
    .bottom-status { align-items: flex-start; flex-direction: column; }
}


/* CertaFamilyFoto photo cards */
.photo-card {
    overflow: hidden;
    min-width: 0;
    border: 1px solid #5c461b;
    border-radius: 11px;
    background: #0b0b0a;
}

.photo-preview-link {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #17130d;
}

.photo-thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s ease;
}

.photo-card:hover .photo-thumbnail {
    transform: scale(1.03);
}

.photo-media-fallback {
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    padding: 12px;
    color: var(--gold);
    background:
        radial-gradient(circle at top, #49391e, #17130d 55%, #090909);
    font-size: 12px;
    text-align: center;
}

.photo-caption {
    padding: 10px 12px 12px;
}

.photo-caption span,
.photo-caption small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-caption small {
    margin-top: 4px;
    color: var(--muted);
}


/* CertaFamilyFoto full gallery */
.gallery-panel {
    margin-top: 25px;
    min-height: 500px;
}

.gallery-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #342a18;
}

.pagination a,
.pagination-disabled {
    padding: 10px 14px;
    border: 1px solid #5f481b;
    border-radius: 8px;
    color: var(--gold);
    text-decoration: none;
}

.pagination-disabled {
    color: #69645b;
    border-color: #2d2921;
}

@media (max-width: 1450px) {
    .gallery-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 1150px) {
    .gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* CertaFamilyFoto photo detail */
.photo-detail-page {
    min-height: calc(100vh - 124px);
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--gold);
    text-decoration: none;
}

.message-box {
    margin-bottom: 18px;
    padding: 13px 16px;
    border: 1px solid #5f481b;
    border-radius: 10px;
    background: rgba(223, 179, 79, .1);
}

.photo-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, .7fr);
    gap: 22px;
}

.photo-detail-image,
.photo-detail-info {
    border: 1px solid #493818;
    border-radius: 15px;
    background: linear-gradient(145deg, #141411, #0c0c0b);
}

.photo-detail-image {
    min-height: 500px;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 15px;
}

.photo-detail-image img {
    display: block;
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
}

.photo-detail-info {
    padding: 24px;
}

.photo-detail-info h1 {
    margin: 0 0 24px;
    overflow-wrap: anywhere;
    color: var(--gold);
    font-family: Georgia, serif;
    font-weight: 400;
}

.photo-detail-info dl {
    margin: 0;
}

.photo-detail-info dt {
    margin-top: 18px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.photo-detail-info dd {
    margin: 5px 0 0;
}

.photo-actions {
    display: grid;
    gap: 10px;
    margin-top: 30px;
}

.photo-actions button {
    padding: 13px;
    border: 1px solid #6f531e;
    border-radius: 9px;
    cursor: pointer;
    color: var(--gold);
    background: rgba(223, 179, 79, .08);
}

.photo-actions button:hover {
    background: rgba(223, 179, 79, .16);
}

.photo-actions .danger-button {
    margin-top: 12px;
    border-color: #713b36;
    color: #ffaaa2;
    background: rgba(160, 48, 38, .1);
}

@media (max-width: 900px) {
    .photo-detail-layout {
        grid-template-columns: 1fr;
    }

    .photo-detail-image {
        min-height: 300px;
    }
}


/* CertaFamilyFoto trash */
.trash-message {
    margin-top: 22px;
}

.trash-photo-card {
    opacity: .88;
}

.restore-form {
    margin-top: 12px;
}

.restore-form button {
    width: 100%;
    padding: 10px;
    border: 1px solid #5f481b;
    border-radius: 8px;
    cursor: pointer;
    color: var(--gold);
    background: rgba(223, 179, 79, .08);
}

.restore-form button:hover {
    background: rgba(223, 179, 79, .16);
}


/* CertaFamilyFoto video player */
.photo-detail-video {
    display: block;
    width: 100%;
    max-height: 75vh;
    background: #000;
    border-radius: 10px;
}

.video-tile-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.video-tile-link .photo-media-fallback {
    transition: background .2s ease;
}

.video-tile-link:hover .photo-media-fallback {
    background:
        radial-gradient(
            circle at top,
            #654d24,
            #21190e 55%,
            #090909
        );
}


/* CertaFamilyFoto empty trash */
.empty-trash-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin-top: 22px;
    padding: 17px 19px;
    border: 1px solid #713b36;
    border-radius: 12px;
    background: rgba(160, 48, 38, .08);
}

.empty-trash-form strong,
.empty-trash-form span {
    display: block;
}

.empty-trash-form span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.empty-trash-form input {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #713b36;
    border-radius: 8px;
    outline: none;
    color: var(--text);
    background: #0b0b0a;
}

.empty-trash-form input:focus {
    border-color: #d16c61;
}

.empty-trash-form button {
    padding: 12px 15px;
    border: 1px solid #8c473f;
    border-radius: 8px;
    cursor: pointer;
    color: #ffb1aa;
    background: rgba(160, 48, 38, .18);
}

@media (max-width: 850px) {
    .empty-trash-form {
        grid-template-columns: 1fr;
    }
}


/* CertaFamilyFoto bulk gallery selection */
.bulk-trash-form {
    display: block;
}

.bulk-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, .025);
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}

.select-all-label input {
    width: 18px;
    height: 18px;
    accent-color: #c9a84c;
}

.bulk-actions button {
    padding: 11px 15px;
    border: 1px solid #8c473f;
    border-radius: 8px;
    cursor: pointer;
    color: #ffb1aa;
    background: rgba(160, 48, 38, .18);
}

.bulk-actions button:disabled {
    cursor: not-allowed;
    opacity: .4;
}

.selectable-photo-card {
    position: relative;
}

.photo-select {
    position: absolute;
    z-index: 10;
    top: 9px;
    left: 9px;
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.photo-select input {
    position: absolute;
    opacity: 0;
}

.photo-select span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255, 255, 255, .9);
    border-radius: 7px;
    color: transparent;
    background: rgba(0, 0, 0, .65);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}

.photo-select input:checked + span {
    border-color: #c9a84c;
    color: #111;
    background: #c9a84c;
}

.selectable-photo-card:has(
    .photo-select-checkbox:checked
) {
    outline: 3px solid #c9a84c;
    outline-offset: -3px;
}

@media (max-width: 700px) {
    .bulk-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .bulk-actions button {
        width: 100%;
    }
}

/* CertaFamilyFoto photo folders */
.folder-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .025);
}

.folder-create-form {
    display: flex;
    gap: 10px;
}

.folder-create-form input,
.bulk-actions select {
    min-width: 190px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    background: #0b0b0a;
}

.folder-create-form button,
#bulk-folder-button {
    padding: 10px 14px;
    border: 1px solid #927a35;
    border-radius: 8px;
    cursor: pointer;
    color: #ead58e;
    background: rgba(201, 168, 76, .12);
}

.folder-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.folder-list a {
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    background: rgba(255, 255, 255, .025);
}

.folder-list a:hover {
    border-color: #c9a84c;
}

@media (max-width: 900px) {
    .folder-panel,
    .folder-create-form {
        align-items: stretch;
        flex-direction: column;
    }

    .folder-list {
        justify-content: flex-start;
    }

    .folder-create-form input {
        width: 100%;
    }
}
