/* EmoryDay Creative Portal – design system from dashboard mockup */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    /* Primary & accent */
    --ed-blue: #2E86C1;
    --ed-blue-dark: #2471A3;
    --ed-orange: #F5B041;
    --ed-orange-light: #FEF5E7;
    --ed-green: #2ECC71;
    --ed-green-dark: #27AE60;
    --ed-red: #E74C3C;
    /* Text */
    --ed-text: #333333;
    --ed-text-medium: #666666;
    --ed-text-muted: #999999;
    /* Surfaces & borders */
    --ed-bg: #F2F4F7;
    --ed-card-bg: #FFFFFF;
    --ed-border: #E0E0E0;
    --ed-border-light: #DDDDDD;
    /* Typography */
    --ed-font: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica Neue, Arial, sans-serif;
    --ed-radius: 6px;
    --ed-radius-lg: 8px;
    --ed-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Spacing (mockup: card 20–30px, between cards 20–25px) */
    --ed-space-xs: 5px;
    --ed-space-sm: 10px;
    --ed-space-md: 15px;
    --ed-space-lg: 20px;
    --ed-space-xl: 25px;
    --ed-space-2xl: 30px;
}

body {
    margin: 0;
    font-family: var(--ed-font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    background-color: var(--ed-bg);
    color: var(--ed-text);
}

a {
    color: var(--ed-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Header – white bar, dark text, subtle border (mockup) */
.ed-header {
    background: var(--ed-card-bg);
    color: var(--ed-text);
    padding: var(--ed-space-md) var(--ed-space-xl);
    border-bottom: 1px solid var(--ed-border);
}

.ed-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ed-logo {
    display: flex;
    align-items: center;
    gap: var(--ed-space-sm);
    font-weight: 700;
    font-size: 22px;
    color: var(--ed-text);
}

.ed-logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ed-orange);
    color: var(--ed-card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.ed-logo-text {
    font-size: 22px;
    letter-spacing: -0.02em;
}

.ed-nav {
    display: flex;
    gap: var(--ed-space-lg);
}

.ed-nav-link {
    color: var(--ed-text-medium);
    font-size: 15px;
    font-weight: 500;
}

.ed-nav-link:hover {
    color: var(--ed-blue);
}

/* Main content */
.ed-main {
    max-width: 1120px;
    margin: var(--ed-space-xl) auto var(--ed-space-2xl);
    padding: 0 var(--ed-space-lg);
}

/* Cards – white, 6–8px radius, 2px 4px shadow, 20–30px padding */
.ed-card {
    background: var(--ed-card-bg);
    border-radius: var(--ed-radius-lg);
    box-shadow: var(--ed-shadow);
    padding: var(--ed-space-2xl) var(--ed-space-xl);
    border: 1px solid var(--ed-border-light);
}

.ed-card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ed-text);
    margin: 0 0 var(--ed-space-md);
}

.ed-card > p,
.ed-card-desc {
    font-size: 14px;
    color: var(--ed-text-medium);
    margin: 0 0 var(--ed-space-lg);
}

/* Forms – spacing between fields 15–20px */
.ed-form {
    display: flex;
    flex-direction: column;
    gap: var(--ed-space-lg);
    margin-top: var(--ed-space-md);
}

.ed-field {
    display: flex;
    flex-direction: column;
    gap: var(--ed-space-xs);
}

.ed-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ed-text-medium);
}

.ed-field-hint {
    font-size: 12px;
    color: var(--ed-text-muted);
    margin: var(--ed-space-xs) 0 0;
}

.ed-input,
.ed-textarea,
.ed-select {
    border-radius: var(--ed-radius);
    border: 1px solid var(--ed-border);
    padding: var(--ed-space-sm) var(--ed-space-md);
    font-size: 15px;
    font-family: inherit;
    min-height: 40px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ed-textarea {
    min-height: 100px;
    resize: vertical;
}

.ed-input:focus,
.ed-textarea:focus,
.ed-select:focus {
    outline: none;
    border-color: var(--ed-blue);
    box-shadow: 0 0 0 3px rgba(46, 134, 193, 0.15);
}

.ed-input::placeholder,
.ed-textarea::placeholder {
    color: var(--ed-text-muted);
}

.ed-form-actions {
    display: flex;
    gap: var(--ed-space-sm);
    align-items: center;
    margin-top: var(--ed-space-sm);
    padding-top: var(--ed-space-sm);
}

/* Buttons – primary = green (mockup "+ NEW"), ghost = blue link style */
.ed-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--ed-radius);
    padding: var(--ed-space-sm) var(--ed-space-md);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ed-button-primary {
    background: var(--ed-green);
    color: #ffffff;
}

.ed-button-primary:hover {
    background: var(--ed-green-dark);
}

.ed-button-ghost {
    background: transparent;
    color: var(--ed-blue);
}

.ed-button-ghost:hover {
    background: var(--ed-orange-light);
}

/* Flash messages */
.ed-flash {
    border-radius: var(--ed-radius);
    padding: var(--ed-space-md) var(--ed-space-lg);
    margin-bottom: var(--ed-space-lg);
    font-size: 14px;
}

.ed-flash-success {
    background: #E8F8F5;
    color: #1E8449;
    border: 1px solid #A9DFBF;
}

.ed-flash-error {
    background: #FDEDEC;
    color: var(--ed-red);
    border: 1px solid #F5B7B1;
}

/* Tables – single border between rows, no alternating fill */
.ed-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: var(--ed-space-lg);
}

.ed-table th,
.ed-table td {
    padding: var(--ed-space-md) var(--ed-space-sm);
    border-bottom: 1px solid var(--ed-border);
    text-align: left;
}

.ed-table th {
    font-weight: 600;
    color: var(--ed-text-medium);
    background: var(--ed-card-bg);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.ed-table-actions {
    display: flex;
    gap: var(--ed-space-sm);
}

/* Footer */
.ed-footer {
    border-top: 1px solid var(--ed-border);
    padding: var(--ed-space-lg) var(--ed-space-xl);
    background: var(--ed-card-bg);
}

.ed-footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    font-size: 13px;
    color: var(--ed-text-muted);
}

/* Client presentation */
.ed-presentation-header {
    margin-bottom: var(--ed-space-xl);
}

.ed-presentation-client {
    font-size: 24px;
    font-weight: 700;
    color: var(--ed-text);
}

.ed-presentation-project {
    margin-top: var(--ed-space-xl);
    padding: var(--ed-space-lg) 0;
    border-bottom: 1px solid var(--ed-border);
}

.ed-presentation-project:last-child {
    border-bottom: none;
}

.ed-presentation-project-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--ed-space-xs);
    color: var(--ed-text);
}

.ed-presentation-project-meta {
    font-size: 13px;
    color: var(--ed-text-muted);
}

/* Asset grid – 20–25px gap between cards */
.ed-asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--ed-space-xl);
    margin-top: var(--ed-space-lg);
}

.ed-asset-tile {
    border-radius: var(--ed-radius-lg);
    background: var(--ed-card-bg);
    border: 1px solid var(--ed-border);
    padding: var(--ed-space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--ed-space-sm);
    box-shadow: var(--ed-shadow);
}

.ed-asset-thumb {
    border-radius: var(--ed-radius);
    background: var(--ed-bg);
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--ed-text-muted);
    overflow: hidden;
}

.ed-asset-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ed-asset-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ed-text);
}

.ed-asset-meta {
    font-size: 13px;
    color: var(--ed-text-muted);
}

.ed-asset-actions {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

.ed-asset-actions .ed-button {
    font-size: 14px;
}

/* ─── Gallery – upload preview ─── */
.ed-hidden { display: none !important; }

.ed-gallery-upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ed-gallery-upload-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--ed-border);
}

/* ─── Admin assets table – gallery badge & thumb ─── */
.ed-admin-thumb {
    position: relative;
    display: inline-block;
}

.ed-gallery-badge {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    padding: 1px 5px;
    pointer-events: none;
}

/* ─── Gallery manage page – admin image grid ─── */
.ed-gallery-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--ed-space-md);
}

.ed-gallery-admin-item {
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius);
    overflow: hidden;
    background: var(--ed-bg);
}

.ed-gallery-admin-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.ed-gallery-admin-actions {
    display: flex;
    gap: 4px;
    padding: 6px;
    justify-content: flex-end;
    background: #fff;
}

/* ─── Client presentation – gallery mosaic tile ─── */
.ed-asset-tile--gallery .ed-asset-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ed-asset-gallery-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--ed-text-muted);
    background: var(--ed-bg);
    border: 1px solid var(--ed-border);
    border-radius: 999px;
    padding: 1px 8px;
    white-space: nowrap;
}

.ed-gallery-mosaic {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 3px;
    border-radius: var(--ed-radius);
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    position: relative;
    background: var(--ed-bg);
    outline: none;
}

.ed-gallery-mosaic:focus-visible {
    box-shadow: 0 0 0 3px rgba(46, 134, 193, 0.4);
}

/* Single image: full width */
.ed-gallery-mosaic img:only-child {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
}

/* Two images side by side */
.ed-gallery-mosaic img:first-child:nth-last-child(2),
.ed-gallery-mosaic img:nth-child(2):last-child {
    grid-column: auto;
    grid-row: 1 / -1;
}

.ed-gallery-mosaic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.ed-gallery-mosaic:hover img {
    transform: scale(1.03);
}

.ed-gallery-mosaic-more {
    position: absolute;
    bottom: 6px;
    right: 8px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    padding: 2px 10px;
    pointer-events: none;
}

/* ─── Lightbox ─── */
.ed-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ed-lightbox[hidden] { display: none; }

.ed-lightbox-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 90vh;
}

.ed-lightbox-img {
    max-width: 85vw;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    display: block;
}

.ed-lightbox-caption {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
    min-height: 1.2em;
}

.ed-lightbox-counter {
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    margin-top: 4px;
    text-align: center;
}

.ed-lightbox-close,
.ed-lightbox-prev,
.ed-lightbox-next {
    position: absolute;
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    transition: background 0.15s;
}

.ed-lightbox-close:hover,
.ed-lightbox-prev:hover,
.ed-lightbox-next:hover {
    background: rgba(255,255,255,0.25);
}

.ed-lightbox-close {
    top: 16px;
    right: 16px;
    font-size: 22px;
}

.ed-lightbox-prev {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.ed-lightbox-next {
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

@media (max-width: 640px) {
    .ed-header-inner,
    .ed-main,
    .ed-footer-inner {
        padding-left: var(--ed-space-md);
        padding-right: var(--ed-space-md);
    }

    .ed-gallery-mosaic {
        aspect-ratio: auto;
        height: 180px;
    }

    .ed-lightbox-prev { left: 6px; }
    .ed-lightbox-next { right: 6px; }
}
