/* ═══════════════════════════════════════════════════
   Design Tokens — Procert Color Identity
   Primary brand blue: #1B75BB (extracted from logo)
═══════════════════════════════════════════════════ */
:root {
    /* Procert Blue palette */
    --accent:         #1B75BB;
    --accent-hover:   #155F9E;
    --accent-dark:    #0D3B6E;
    --accent-light:   #E2EEF8;
    --accent-ring:    rgba(27, 117, 187, 0.16);

    /* Surfaces */
    --bg:             #EDF2F7;
    --surface:        #FFFFFF;
    --surface-2:      #F5F9FD;

    /* Text */
    --text-primary:   #0D2240;
    --text-secondary: #3D5870;
    --text-muted:     #7E9BB5;

    /* Borders */
    --border:         #C6D8E8;
    --border-strong:  #96B4CB;

    /* Semantic */
    --error:          #C23B2E;
    --error-bg:       #FDF2F1;
    --success:        #1B7A4A;
    --success-bg:     #EDF7F2;

    /* Shadows */
    --shadow-xs:  0 1px 2px rgba(13, 34, 64, 0.05);
    --shadow-sm:  0 2px 6px rgba(13, 34, 64, 0.08);
    --shadow-md:  0 6px 18px rgba(13, 34, 64, 0.11);
    --shadow-lg:  0 12px 40px rgba(13, 34, 64, 0.14);
    --shadow-xl:  0 24px 64px rgba(13, 34, 64, 0.18);

    /* Geometry */
    --radius-xs:  6px;
    --radius-sm:  10px;
    --radius:     16px;
    --radius-lg:  24px;

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Motion */
    --ease:        cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══════════════════════════════════════════════════
   Reset & Base
═══════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════
   Page Layout
═══════════════════════════════════════════════════ */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 24px 80px;
}

.container {
    width: 100%;
    max-width: 860px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ═══════════════════════════════════════════════════
   Header
═══════════════════════════════════════════════════ */
.header {
    text-align: center;
    padding-bottom: 12px;
}

.header-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 18px;
}

.header-eyebrow-dot {
    width: 5px;
    height: 5px;
    background: var(--accent);
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2.4s ease infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.45; transform: scale(0.65); }
}

.header h1 {
    font-size: clamp(30px, 5.5vw, 46px);
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    line-height: 1.12;
    margin-bottom: 14px;
}

.header h1 span {
    color: var(--accent);
}

.header-sub {
    font-size: 15.5px;
    color: var(--text-secondary);
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.65;
}

/* ═══════════════════════════════════════════════════
   Stats Bar
═══════════════════════════════════════════════════ */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 5px 14px;
    font-size: 12.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-chip svg {
    color: var(--accent);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   Drop Zone
═══════════════════════════════════════════════════ */
.drop-zone {
    position: relative;
    background: var(--surface);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 64px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.22s var(--ease);
    box-shadow: var(--shadow-xs);
    user-select: none;
}

.drop-zone:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: var(--shadow-sm), 0 0 0 4px var(--accent-ring);
    transform: translateY(-1px);
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: var(--shadow-md), 0 0 0 6px var(--accent-ring);
    transform: scale(1.012) translateY(-2px);
}

.drop-zone.drop-zone--full {
    border-color: var(--border);
    cursor: default;
    opacity: 0.65;
}

.drop-icon-wrap {
    width: 64px;
    height: 64px;
    background: var(--accent-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 22px;
    transition: all 0.22s var(--ease);
}

.drop-zone:hover .drop-icon-wrap,
.drop-zone.drag-over .drop-icon-wrap {
    background: var(--accent);
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(27, 117, 187, 0.32);
}

.drop-icon-wrap svg {
    width: 26px;
    height: 26px;
    color: var(--accent);
    transition: all 0.22s var(--ease);
}

.drop-zone:hover .drop-icon-wrap svg,
.drop-zone.drag-over .drop-icon-wrap svg {
    color: #fff;
}

.drop-title {
    font-size: 20px;
    font-weight: 650;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.drop-desc {
    font-size: 14.5px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.drop-desc strong {
    color: var(--accent);
    font-weight: 600;
}

.btn-browse {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-dark);
    color: #fff;
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 600;
    padding: 11px 26px;
    border-radius: 100px;
    border: none;
    cursor: pointer;
    transition: all 0.18s var(--ease);
    letter-spacing: 0.01em;
}

.btn-browse:hover {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-browse:active {
    transform: translateY(0);
}

.btn-browse svg { flex-shrink: 0; }

.drop-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Camera capture — only offered on touch devices (phones/tablets) */
.btn-camera {
    display: none;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--accent);
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 600;
    padding: 11px 26px;
    border-radius: 100px;
    border: 1.5px solid rgba(27, 117, 187, 0.35);
    cursor: pointer;
    transition: all 0.18s var(--ease);
    letter-spacing: 0.01em;
}

.btn-camera:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.btn-camera svg { flex-shrink: 0; }

@media (pointer: coarse) {
    .btn-camera { display: inline-flex; }
}

/* ═══════════════════════════════════════════════════
   Preview Section
═══════════════════════════════════════════════════ */
.preview-section {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-xs);
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-title {
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.counter-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.counter {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 100px;
    border: 1px solid var(--border);
    transition: all 0.18s var(--ease);
    font-variant-numeric: tabular-nums;
}

.counter.full {
    color: var(--accent);
    background: var(--accent-light);
    border-color: rgba(27, 117, 187, 0.3);
}

.btn-add-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    color: var(--accent);
    font-family: var(--font);
    font-size: 12.5px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    border: 1px solid rgba(27, 117, 187, 0.35);
    cursor: pointer;
    transition: all 0.18s var(--ease);
}

.btn-add-more:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.btn-add-more:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Camera capture — only offered on touch devices (phones/tablets) */
.btn-add-camera {
    display: none;
    align-items: center;
    gap: 5px;
    background: transparent;
    color: var(--accent);
    font-family: var(--font);
    font-size: 12.5px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    border: 1px solid rgba(27, 117, 187, 0.35);
    cursor: pointer;
    transition: all 0.18s var(--ease);
}

.btn-add-camera:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.btn-add-camera:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (pointer: coarse) {
    .btn-add-camera { display: inline-flex; }
}

/* ═══════════════════════════════════════════════════
   Preview Grid
═══════════════════════════════════════════════════ */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
}

.preview-card {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg);
    border: 1px solid var(--border);
    transition: all 0.2s var(--ease);
    animation: card-in 0.28s var(--ease-spring) both;
}

@keyframes card-in {
    from { opacity: 0; transform: scale(0.88) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.preview-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    border-color: var(--accent);
}

.preview-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.preview-card-info {
    padding: 8px 10px 10px;
}

.preview-name {
    display: block;
    font-size: 11px;
    font-weight: 550;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.preview-size {
    display: block;
    font-size: 10.5px;
    color: var(--text-muted);
}

.remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(13, 34, 64, 0.72);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.16s var(--ease);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.remove-btn:hover {
    background: var(--error);
    transform: scale(1.1);
}

.preview-card:hover .remove-btn {
    opacity: 1;
}

@media (hover: none) {
    .remove-btn { opacity: 1; }
}

/* ═══════════════════════════════════════════════════
   Generate Button
═══════════════════════════════════════════════════ */
.generate-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-top: 4px;
}

.btn-generate {
    position: relative;
    width: 100%;
    max-width: 440px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 650;
    padding: 16px 36px;
    border-radius: 100px;
    border: none;
    cursor: pointer;
    transition: all 0.22s var(--ease);
    letter-spacing: 0.01em;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(27, 117, 187, 0.3);
}

.btn-generate::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.14) 0%, transparent 55%);
    pointer-events: none;
}

.btn-generate:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(27, 117, 187, 0.4);
}

.btn-generate:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(27, 117, 187, 0.22);
}

.btn-generate:disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-generate svg { flex-shrink: 0; }

.generate-hint {
    font-size: 12.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.generate-hint svg { color: var(--accent); }

/* ═══════════════════════════════════════════════════
   Loading Overlay
═══════════════════════════════════════════════════ */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13, 34, 64, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: overlay-in 0.22s var(--ease) both;
}

@keyframes overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.loading-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 48px 56px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: card-up 0.3s var(--ease-spring) both;
    max-width: 340px;
    width: 100%;
    border-top: 3px solid var(--accent);
}

@keyframes card-up {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.spinner-wrap {
    width: 60px;
    height: 60px;
    position: relative;
    margin-bottom: 28px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.spinner-inner {
    position: absolute;
    inset: 8px;
    border: 2px solid transparent;
    border-top-color: rgba(27, 117, 187, 0.3);
    border-radius: 50%;
    animation: spin 1.4s linear infinite reverse;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-title {
    font-size: 17px;
    font-weight: 650;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.loading-sub {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ═══════════════════════════════════════════════════
   Toast Notifications
═══════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    color: var(--text-primary);
    padding: 13px 20px 13px 16px;
    border-radius: 100px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
    transition: all 0.32s var(--ease-spring);
    max-width: min(520px, calc(100vw - 48px));
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(16px);
    opacity: 0;
    pointer-events: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-error   .toast-icon { background: var(--error);   color: #fff; }
.toast-success .toast-icon { background: var(--success);  color: #fff; }

.toast-error   { border-left: 3px solid var(--error); }
.toast-success { border-left: 3px solid var(--success); }

/* ═══════════════════════════════════════════════════
   Responsive
═══════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .page-wrapper {
        padding: 40px 16px 64px;
    }

    .drop-zone {
        padding: 48px 24px;
        border-radius: var(--radius);
    }

    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }

    .preview-section {
        padding: 18px 16px;
    }

    .loading-card {
        padding: 40px 32px;
    }

    .header h1 {
        font-size: 28px;
    }

    .stats-bar {
        gap: 5px;
    }
}

@media (max-width: 400px) {
    .preview-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .btn-generate {
        font-size: 14px;
        padding: 14px 24px;
    }
}
