/* Arca Consent - admin stylesheet.
 * Hand-written, no framework: the strict Content-Security-Policy
 * (script-src 'self'; style-src 'self') rules out Tailwind's play-CDN and any
 * inline styles or scripts. Headings use the same self-hosted Cormorant Garamond as
 * the public side (see app/static/fonts/, sha256 + source in
 * app/static/js/vendor/VERSIONS.md); body text stays on the system sans stack.
 */

/* ---------- Fonts ---------- */

@font-face {
    font-family: "Cormorant Garamond";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/cormorant-garamond-500.woff2") format("woff2");
}

@font-face {
    font-family: "Cormorant Garamond";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/cormorant-garamond-600.woff2") format("woff2");
}

/* ---------- Reset / base ---------- */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: #ffffff;
    color: #1f2320;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    font-weight: 500;
    color: #1f2320;
    margin: 0 0 0.5em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }

p {
    margin: 0 0 1em;
}

a {
    color: #B3573D;
    text-decoration: underline;
}

a:hover {
    text-decoration: none;
}

code {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: #f4f2f0;
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

hr.divider {
    border: none;
    border-top: 1px solid #e3ddd8;
    margin: 1.5em 0;
}

/* ---------- Layout ---------- */

.site-header {
    border-bottom: 1px solid #e3ddd8;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Same wordmark as the public side (see public.css): real uppercase, no small-caps. */
.wordmark {
    font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-weight: 500;
    font-size: 1rem;
    color: #1f2320;
    text-decoration: none;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.main-nav a {
    color: #1f2320;
    text-decoration: none;
    font-size: 0.9rem;
}

.main-nav a:hover {
    color: #B3573D;
}

.logout-form {
    margin: 0;
    display: inline;
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: #1f2320;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
}

.link-button:hover {
    color: #B3573D;
}

.main-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

.site-footer {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2.5rem;
    color: #8a8279;
    font-size: 0.85rem;
}

.page-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    margin: 0;
}

/* ---------- Flash messages ---------- */

.flash-container {
    max-width: 960px;
    margin: 1rem auto 0;
    padding: 0 1.25rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.flash.success {
    background: #eaf5ec;
    color: #256029;
}

.flash.error {
    background: #fbeae7;
    color: #9c3421;
}

.flash.info {
    background: #f0f2f4;
    color: #33414d;
}

/* ---------- Auth pages ---------- */

.auth-page {
    max-width: 420px;
    margin: 0 auto;
}

.auth-page h1 {
    text-align: center;
}

.auth-card {
    border: 1px solid #e3ddd8;
    border-radius: 6px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.auth-intro, .auth-note {
    font-size: 0.9rem;
    color: #5b564f;
    text-align: center;
}

.auth-card .auth-intro {
    text-align: left;
}

p.auth-note {
    margin-top: 1rem;
}

/* ---------- Account page ---------- */

.account-page {
    max-width: 640px;
    margin: 0 auto;
}

.account-card {
    border: 1px solid #e3ddd8;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.account-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* ---------- Forms ---------- */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input:not([type]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid #cfc8c0;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: #ffffff;
    color: #1f2320;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 2px solid #B3573D;
    outline-offset: 1px;
    border-color: #B3573D;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

.form-errors, .field-errors, .field-error {
    list-style: none;
    margin: 0.4rem 0 0;
    padding: 0;
    color: #9c3421;
    font-size: 0.85rem;
}

.form-errors {
    margin-bottom: 1rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid #cfc8c0;
    border-radius: 4px;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.radio-option:hover {
    background: #faf8f6;
}

/* ---------- Signature pad ---------- */

.signature-pad-section {
    margin: 1.5rem 0;
}

.signature-pad {
    display: block;
    width: 100%;
    height: 220px;
    border: 1px solid #cfc8c0;
    border-radius: 4px;
    background: #ffffff;
    touch-action: none;
}

.signature-pad-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

#signature-error {
    color: #9c3421;
    font-size: 0.85rem;
    margin: 0.4rem 0 0;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-block;
    border: none;
    border-radius: 4px;
    padding: 0.55rem 1.25rem;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: #B3573D;
    color: #ffffff;
}

.btn-primary:hover {
    background: #98452f;
}

.btn-secondary {
    background: #f0efec;
    color: #1f2320;
}

.btn-secondary:hover {
    background: #e3ddd8;
}

/* ---------- QR / recovery codes ---------- */

.qr-block {
    text-align: center;
}

.qr-code {
    max-width: 220px;
    border: 1px solid #e3ddd8;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.key-code {
    display: inline-block;
    word-break: break-all;
    margin-top: 0.25rem;
}

.code-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.code-list li {
    margin-bottom: 0.4rem;
}

.info-banner {
    background: #f0f2f4;
    color: #33414d;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ---------- Status pills (Phase 1 uses these on release tables) ---------- */

.pill {
    display: inline-block;
    padding: 0.15em 0.7em;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.pill-on {
    background: #eaf5ec;
    color: #256029;
}

.pill-off {
    background: #f0efec;
    color: #5b564f;
}

.pill.status-draft { background: #f0efec; color: #5b564f; }
.pill.status-sent { background: #eef2f8; color: #2f4f77; }
.pill.status-opened { background: #fdf3e2; color: #8a5a10; }
.pill.status-model_signed { background: #f2ecfa; color: #5b3a92; }
.pill.status-completed { background: #eaf5ec; color: #256029; }
.pill.status-expired { background: #f0efec; color: #8a8279; }
.pill.status-revoked { background: #fbeae7; color: #9c3421; }
.pill.status-signed_external { background: #e8f2f2; color: #276a6a; }
.pill.status-archived,
.pill.pill-archived { background: #ecebe8; color: #6b655d; }

/* A shoot without a completed/externally-signed release, or a missing countersignature
 * warning on the release/settings pages (Phase 1 admin). Reuses the "revoked" red. */
.pill.pill-warning { background: #fbeae7; color: #9c3421; }

/* ---------- Tables ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #e3ddd8;
}

th {
    font-weight: 600;
    color: #5b564f;
}

/* ---------- Phase 1: dashboard, detail pages, comments, filters ---------- */

.dashboard-section {
    margin-bottom: 2rem;
}

.dashboard-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dashboard-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e3ddd8;
}

.detail-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1.5rem;
    margin: 0 0 1.5rem;
}

.detail-list dt {
    font-weight: 600;
    color: #5b564f;
}

.detail-list dd {
    margin: 0;
}

/* A secondary detail next to a primary one, e.g. the internal release id next to the
   public id on the release detail page. */
.muted {
    color: #8a8279;
    font-size: 0.9em;
}

.comments-box {
    background: #fdf3e2;
    border: 1px solid #f0d9a6;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.comments-box h2 {
    margin-top: 0;
}

.signature-image {
    display: block;
    max-width: 320px;
    border: 1px solid #e3ddd8;
    border-radius: 4px;
    padding: 0.5rem;
    margin-bottom: 1.5rem;
    background: #ffffff;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.filter-bar .pill {
    text-decoration: none;
    border: 1px solid transparent;
}

.filter-bar .pill.pill-on {
    border-color: #B3573D;
}

.form-help {
    font-size: 0.85rem;
    color: #5b564f;
    margin: 0.35rem 0 0;
}

.flash.link {
    word-break: break-all;
}

.copy-link-button {
    margin-left: 0.75rem;
}

/* ---------- Error pages ---------- */

.error-page {
    max-width: 560px;
    margin: 3rem auto 0;
    text-align: center;
}

.error-page .btn {
    margin-top: 1rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
    .main-nav {
        gap: 0.75rem;
    }
}

/* ---------- Phase 2: decline / resend actions and the bounce pill ---------- */

/* Each action on the release detail page is its own form; without this they would run
   into each other now that there are up to three below "Actions". */
.action-form {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e7e4df;
}

/* The reason a release was declined, in the same register as .comments-box but in the
   warning colour: this is the end of the agreement, not a note. */
.declined-box {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    background: #fbeae7;
    border-left: 3px solid #9c3421;
    border-radius: 4px;
}

.declined-box h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: #9c3421;
}

.declined-box p {
    margin: 0;
    white-space: pre-wrap;
}

/* Declining is destructive enough to be visually separate from the primary action. */
.btn-danger {
    background: #9c3421;
    color: #fff;
    border: 1px solid #9c3421;
}

.btn-danger:hover {
    background: #862b1a;
    border-color: #862b1a;
}

/* ---------- Phase 2: external releases and the GDPR tools ---------- */

/* Several buttons next to the page title (edit / export / delete). */
.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* An irreversible action: deleting a model with everything attached to it. */
.btn-danger {
    background: #9c3421;
    color: #ffffff;
}

.btn-danger:hover {
    background: #7f2a1a;
}

/* The "this cannot be undone" explanation above the confirmation field. */
.danger-box {
    border: 1px solid #e6bdb3;
    border-left: 4px solid #9c3421;
    border-radius: 4px;
    background: #fdf4f2;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.danger-box p {
    margin: 0 0 0.5rem;
}

.danger-box ul {
    margin: 0 0 0.5rem;
    padding-left: 1.25rem;
}

.danger-box p:last-child {
    margin-bottom: 0;
}

/* ---------- Phase 3: dashboard status overview ---------- */

.overview-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.overview-count {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid #e3ddd8;
    border-radius: 6px;
    text-decoration: none;
    min-width: 5.5rem;
}

.overview-count:hover {
    border-color: #B3573D;
}

.overview-count-number {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2320;
}

/* ---------- Phase 3: release events timeline ---------- */

.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 2px solid #e3ddd8;
}

.timeline-entry {
    position: relative;
    padding: 0 0 1.25rem 1.25rem;
    margin-left: -1px;
}

.timeline-entry::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 0.35em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #B3573D;
}

.timeline-when {
    margin: 0;
    font-size: 0.85rem;
    color: #5b564f;
}

.timeline-type {
    margin: 0.15rem 0 0;
    font-weight: 600;
}

.timeline-meta {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: #8a8279;
    word-break: break-word;
}

.timeline-details {
    margin: 0.4rem 0 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.15rem 0.75rem;
    font-size: 0.85rem;
}

.timeline-details dt {
    color: #5b564f;
    font-weight: 600;
}

.timeline-details dd {
    margin: 0;
    word-break: break-word;
}

/* ---------- Phase 3: TFP fields on the "New release" form ---------- */

/* Wraps min_images/delivery_weeks/resolution/notes (app/admin/shoots/detail.html);
 * shown only for contract_type=tfp, toggled by admin.js. The [hidden] attribute already
 * does the hiding; this only removes the default <fieldset> border/legend chrome so it
 * reads as an ordinary block of .form-group elements instead of a boxed sub-form. */
fieldset[data-tfp-fields] {
    border: none;
    margin: 0;
    padding: 0;
}

fieldset[data-tfp-fields] legend {
    padding: 0;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #5b564f;
}

/* ---------- Image categories ---------- */

/* admin.js hides the categories of the other contract type with the [hidden]
 * attribute; .radio-option sets its own display, which would otherwise win. */
.radio-option[hidden] {
    display: none;
}

/* A single checkbox with its label (category form). */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

/* ---------- Archive / delete: action buttons as small forms in the page header ---------- */

.inline-form {
    display: inline;
    margin: 0;
}
