/* =====================================================================
   GCU Custom Upload – Frontend CSS  (Premium Flatsome Edition)
   ===================================================================== */

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
    --gcu-primary:      #1a56db;
    --gcu-primary-dk:   #1e40af;
    --gcu-primary-bg:   #eff6ff;
    --gcu-primary-bdr:  #bfdbfe;
    --gcu-success:      #059669;
    --gcu-success-bg:   #ecfdf5;
    --gcu-error:        #dc2626;
    --gcu-error-bg:     #fef2f2;
    --gcu-text:         #111827;
    --gcu-text-soft:    #6b7280;
    --gcu-border:       #e5e7eb;
    --gcu-surface:      #ffffff;
    --gcu-muted-bg:     #f9fafb;
    --gcu-radius:       10px;
    --gcu-radius-sm:    6px;
    --gcu-shadow:       0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --gcu-shadow-md:    0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

/* =====================================================================
   TOAST NOTIFICATION
   ===================================================================== */
.gcu-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #111827;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--gcu-radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    white-space: nowrap;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.gcu-toast.gcu-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =====================================================================
   SLOT GRID – Individual per-file dropzones
   ===================================================================== */
.gcu-slots-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}
.gcu-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 92px;
}
.gcu-slot-num {
    font-size: 10px;
    font-weight: 700;
    color: var(--gcu-text-soft);
    line-height: 1;
}

/* Empty/available slot */
.gcu-slot-dropzone {
    width: 92px;
    height: 92px;
    border: 1.5px dashed var(--gcu-border);
    border-radius: var(--gcu-radius-sm);
    background: var(--gcu-muted-bg);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}
.gcu-slot-dropzone:hover {
    border-color: var(--gcu-primary);
    background: var(--gcu-primary-bg);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.10);
}
.gcu-slot-dropzone.gcu-drag-over {
    border-color: var(--gcu-primary);
    border-style: solid;
    background: var(--gcu-primary-bg);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.15);
}
.gcu-slot-icon { font-size: 22px; line-height: 1; pointer-events: none; }
.gcu-slot-text {
    font-size: 11px;
    color: var(--gcu-text-soft);
    text-align: center;
    line-height: 1.35;
    padding: 0 6px;
    pointer-events: none;
}

/* Empty-required slot */
.gcu-slot-empty-required .gcu-slot-dropzone {
    border-color: var(--gcu-error);
    border-style: dashed;
    background: var(--gcu-error-bg);
    animation: gcu-slot-pulse 1.4s ease-in-out 2;
}
.gcu-slot-empty-required .gcu-slot-text { color: var(--gcu-error); font-weight: 600; }
.gcu-slot-empty-required .gcu-slot-num  { color: var(--gcu-error); }
@keyframes gcu-slot-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(220,38,38,0.40); }
    60%  { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
    100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}

/* Locked slot */
.gcu-slot-locked .gcu-slot-dropzone {
    border-color: var(--gcu-border);
    background: var(--gcu-muted-bg);
    cursor: not-allowed;
    opacity: 0.45;
}
.gcu-slot-locked .gcu-slot-icon { filter: grayscale(1); }
.gcu-slot-locked .gcu-slot-text { color: #aaa; }

/* Uploading state */
.gcu-slot-uploading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    width: 100%;
}
.gcu-slot-fname {
    font-size: 9px;
    color: var(--gcu-text-soft);
    text-align: center;
    max-width: 82px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.gcu-slot-prog {
    width: 74px;
    height: 3px;
    background: var(--gcu-border);
    border-radius: 2px;
    overflow: hidden;
}
.gcu-slot-prog-fill {
    height: 100%;
    background: var(--gcu-primary);
    border-radius: 2px;
    transition: width 0.1s linear;
}
.gcu-slot-pct { font-size: 9px; color: var(--gcu-primary); font-weight: 700; }

/* Done state */
.gcu-slot-done .gcu-slot-dropzone {
    border: 1.5px solid var(--gcu-success);
    background: var(--gcu-success-bg);
    cursor: default;
    padding: 0;
}
.gcu-slot-done-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 4px 4px 2px;
    box-sizing: border-box;
}
.gcu-slot-thumb { width: 100%; height: 46px; display: flex; align-items: center; justify-content: center; }
.gcu-slot-thumb-img { width: 100%; height: 46px; object-fit: cover; display: block; border-radius: 3px; }
.gcu-slot-file-icon { font-size: 26px; }
.gcu-slot-done-inner .gcu-slot-fname {
    font-size: 9px;
    color: var(--gcu-text);
    font-weight: 600;
    max-width: 66px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin-top: 3px;
}

/* Remove button on done slot */
.gcu-slot-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(220,38,38,0.85);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    z-index: 1;
    transition: background 0.15s;
}
.gcu-slot-remove:hover { background: var(--gcu-error); }

/* Hint + clear all footer */
.gcu-slot-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
}
.gcu-slot-hint {
    font-size: 11px;
    color: var(--gcu-text-soft);
}
.gcu-slot-clear-all {
    font-size: 11px;
    font-weight: 600;
    color: var(--gcu-error);
    background: none;
    border: 1px solid #fecaca;
    border-radius: var(--gcu-radius-sm);
    padding: 2px 8px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.gcu-slot-clear-all:hover { background: var(--gcu-error-bg); }

/* Hidden file input inside slot */
.gcu-slot .gcu-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    left: -9999px;
}

/* Responsive */
@media (max-width: 480px) {
    .gcu-slot { width: 66px; }
    .gcu-slot-dropzone { width: 76px; height: 76px; }
}

/* =====================================================================
   SECTION WRAPPER
   ===================================================================== */
.gcu-upload-wrapper {
    margin: 16px 0 20px;
    padding: 0;
    font-family: inherit;
}
.gcu-section-title {
    font-size: 11px;
    font-weight: 700;
    margin: 0 0 14px;
    color: var(--gcu-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* =====================================================================
   FIELDS
   ===================================================================== */
.gcu-field {
    margin-bottom: 16px;
}
.gcu-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--gcu-text);
    letter-spacing: -0.01em;
}
.gcu-required {
    color: var(--gcu-error);
    margin-left: 2px;
}
.gcu-field-note {
    font-size: 12px;
    color: var(--gcu-text-soft);
    background: var(--gcu-muted-bg);
    border-left: 3px solid var(--gcu-border);
    padding: 6px 10px;
    margin: 0 0 10px;
    border-radius: 0 var(--gcu-radius-sm) var(--gcu-radius-sm) 0;
    line-height: 1.5;
}

/* ── Input wrapper (icon support) ───────────────────────────────── */
.gcu-input-wrap {
    position: relative;
    display: block;
}
.gcu-input-icon {
    position: absolute;
    top: 50%;
    left: 13px;
    transform: translateY(-50%);
    color: #9ca3af;
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: color 0.18s;
    line-height: 1;
}
.gcu-textarea-wrap .gcu-input-icon {
    top: 14px;
    transform: none;
}

/* ── Text / Textarea / Date / Number fields ─────────────────────── */
.gcu-text-field,
.gcu-textarea-field,
.gcu-date-field,
.gcu-number-field {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--gcu-border);
    border-radius: var(--gcu-radius-sm);
    font-size: 14px;
    color: var(--gcu-text);
    background: var(--gcu-surface);
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    box-sizing: border-box;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    line-height: 1.5;
}

/* inputs inside icon wrapper get left padding */
.gcu-has-icon .gcu-text-field,
.gcu-has-icon .gcu-date-field,
.gcu-has-icon .gcu-number-field {
    padding-left: 38px;
}

/* hover */
.gcu-text-field:hover,
.gcu-textarea-field:hover,
.gcu-date-field:hover,
.gcu-number-field:hover {
    border-color: #d1d5db;
    background: #fafafa;
}

/* focus */
.gcu-text-field:focus,
.gcu-textarea-field:focus,
.gcu-date-field:focus,
.gcu-number-field:focus {
    border-color: var(--gcu-primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.10);
    background: var(--gcu-surface);
}

/* icon turns blue on sibling focus */
.gcu-input-wrap:focus-within .gcu-input-icon {
    color: var(--gcu-primary);
}

/* textarea specific */
.gcu-textarea-field {
    resize: vertical;
    min-height: 96px;
    line-height: 1.6;
}

/* date – remove native calendar icon clash on webkit */
.gcu-date-field::-webkit-calendar-picker-indicator {
    opacity: 0.5;
    cursor: pointer;
}

/* number – hide spin arrows */
.gcu-number-field::-webkit-inner-spin-button,
.gcu-number-field::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.gcu-number-field { -moz-appearance: textfield; }

/* ── Character counter ──────────────────────────────────────────── */
.gcu-char-counter {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 3px;
    margin-top: 5px;
    font-size: 11px;
    color: var(--gcu-text-soft);
}
.gcu-chars-left {
    font-weight: 600;
    color: var(--gcu-text);
}

/* =====================================================================
   DROPZONE
   ===================================================================== */
.gcu-upload-field { }

.gcu-dropzone {
    border: 1.5px dashed var(--gcu-border);
    border-radius: var(--gcu-radius);
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--gcu-muted-bg);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    position: relative;
    text-align: center;
}
.gcu-dropzone:hover,
.gcu-dropzone:focus {
    border-color: var(--gcu-primary);
    background: var(--gcu-primary-bg);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.10);
    outline: none;
}
.gcu-dropzone.gcu-drag-over {
    border-color: var(--gcu-primary);
    border-style: solid;
    background: var(--gcu-primary-bg);
    box-shadow: 0 0 0 4px rgba(26,86,219,0.14);
}
.gcu-dropzone.gcu-dropzone-full {
    opacity: 0.55;
    pointer-events: none;
}

.gcu-dropzone-inner {
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.gcu-dropzone-icon {
    color: #9ca3af;
    line-height: 1;
    opacity: 1;
}
.gcu-dropzone-icon svg { display: block; }

.gcu-dropzone-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--gcu-text-soft);
    margin: 0;
    line-height: 1.4;
}
.gcu-dropzone-sub { display: none; }
.gcu-dropzone-or {
    font-size: 11px;
    color: #d1d5db;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.06em;
    pointer-events: none;
}

/* ── Browse Button ───────────────────────────────────────────────── */
.gcu-browse-btn {
    pointer-events: all;
    background: var(--gcu-primary) !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(26,86,219,0.30) !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    padding: 9px 28px !important;
    border-radius: 50px !important;
    text-decoration: none !important;
    transition: background 0.18s, box-shadow 0.18s, transform 0.12s !important;
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
    line-height: 1.5 !important;
    letter-spacing: 0.01em !important;
    text-transform: none !important;
    margin-top: 0;
    vertical-align: baseline;
}
.gcu-browse-btn:hover {
    background: var(--gcu-primary-dk) !important;
    box-shadow: 0 4px 16px rgba(26,86,219,0.35) !important;
    transform: translateY(-1px);
    color: #fff !important;
}
.gcu-browse-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(26,86,219,0.25) !important;
}
.gcu-browse-btn:disabled {
    background: #d1d5db !important;
    box-shadow: none !important;
    cursor: not-allowed;
    transform: none;
}

.gcu-dropzone-hint { display: none; }
.gcu-file-counter {
    display: inline-block;
    font-size: 10px;
    color: var(--gcu-primary);
    font-weight: 700;
    background: rgba(26,86,219,0.08);
    padding: 1px 7px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.gcu-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    left: -9999px;
}

/* =====================================================================
   UPLOADED FILES LIST
   ===================================================================== */
.gcu-files-label {
    font-size: 11px;
    color: var(--gcu-text-soft);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 12px 0 6px;
}

.gcu-preview-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 0;
}

.gcu-preview-item {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--gcu-radius-sm);
    background: var(--gcu-surface);
    border: 1px solid var(--gcu-border);
    box-shadow: var(--gcu-shadow);
    animation: gcuFadeIn 0.2s ease;
    position: relative;
    overflow: hidden;
}
.gcu-preview-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gcu-primary);
    border-radius: 3px 0 0 3px;
}
.gcu-preview-item.gcu-uploaded::before {
    background: var(--gcu-success);
}
.gcu-preview-item.gcu-error-item::before {
    background: var(--gcu-error);
}
@keyframes gcuFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* File type badge */
.gcu-file-badge {
    flex-shrink: 0;
    width: 36px;
    height: 40px;
    border-radius: var(--gcu-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1;
}
.gcu-badge-pdf            { background: #ef4444; }
.gcu-badge-doc,
.gcu-badge-docx           { background: var(--gcu-primary); }
.gcu-badge-xls,
.gcu-badge-xlsx           { background: #059669; }
.gcu-badge-zip            { background: #d97706; }
.gcu-badge-txt            { background: #6b7280; }
.gcu-badge-img            { background: #7c3aed; }
.gcu-badge-file           { background: #374151; }

/* Info column */
.gcu-preview-info { flex: 1; min-width: 0; }

.gcu-name-progrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 5px;
}
.gcu-preview-item.gcu-uploaded .gcu-name-progrow { margin-bottom: 2px; }

.gcu-file-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--gcu-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.gcu-progress-pct {
    font-size: 11px;
    font-weight: 700;
    color: var(--gcu-primary);
    flex-shrink: 0;
    min-width: 28px;
    text-align: right;
}

/* Progress track */
.gcu-progress-track {
    height: 3px;
    background: var(--gcu-border);
    border-radius: 999px;
    overflow: hidden;
}
.gcu-progress-fill {
    height: 100%;
    background: var(--gcu-primary);
    border-radius: 999px;
    transition: width 0.1s linear;
}

/* Completed size */
.gcu-file-size-row {
    font-size: 11px;
    color: var(--gcu-text-soft);
    margin-top: 0;
}

/* Actions column (checkmark + delete button) */
.gcu-item-actions {
    display: flex !important;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Check icon on completion */
.gcu-check-icon {
    color: var(--gcu-success);
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
    display: none; /* shown via JS after upload */
}

/* Remove / delete button */
.gcu-upload-wrapper .gcu-remove-btn {
    background: none !important;
    border: 1.5px solid var(--gcu-border) !important;
    cursor: pointer !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center !important;
    justify-content: center !important;
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    border-radius: 50% !important;
    color: #9ca3af !important;
    line-height: 1 !important;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: inherit !important;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.gcu-upload-wrapper .gcu-remove-btn svg {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none;
}
.gcu-upload-wrapper .gcu-remove-btn:hover {
    color: var(--gcu-error) !important;
    border-color: #fca5a5 !important;
    background: var(--gcu-error-bg) !important;
}
/* After upload completes — red trash icon, always visible */
.gcu-upload-wrapper .gcu-remove-btn.gcu-remove-btn-done {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    border-color: #fca5a5 !important;
    color: var(--gcu-error) !important;
    background: var(--gcu-error-bg) !important;
    width: 26px !important;
    height: 26px !important;
}
.gcu-upload-wrapper .gcu-remove-btn.gcu-remove-btn-done svg {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.gcu-upload-wrapper .gcu-remove-btn.gcu-remove-btn-done:hover {
    background: #fee2e2 !important;
    border-color: var(--gcu-error) !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,0.10) !important;
}

/* Status text */
.gcu-upload-status { font-size: 11px; margin-top: 3px; }
.gcu-status-success { color: var(--gcu-success); font-weight: 600; }
.gcu-status-error   { color: var(--gcu-error); font-weight: 600; }
.gcu-status-pending { color: var(--gcu-text-soft); }

/* =====================================================================
   ADD-TO-CART DISABLED STATE
   ===================================================================== */
.single_add_to_cart_button.gcu-upload-pending,
.single_add_to_cart_button.gcu-upload-pending:hover {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: auto !important;
    filter: grayscale(0.4);
}

/* =====================================================================
   ERROR MESSAGES
   ===================================================================== */
.gcu-error-container { margin-top: 6px; }
.gcu-error-msg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--gcu-error-bg);
    border: 1px solid #fecaca;
    color: var(--gcu-error);
    border-radius: var(--gcu-radius-sm);
    font-size: 12px;
    font-weight: 500;
    margin: 4px 0;
    animation: gcuFadeIn 0.2s ease;
}

/* =====================================================================
   STICKY ADD-TO-CART BAR — Hide plugin fields
   Covers Astra (.ast-sticky-add-to-cart), WooCommerce core sticky,
   and common plugin/theme sticky bar selectors.
   ===================================================================== */
.ast-sticky-add-to-cart .gcu-upload-wrapper,
.sticky-add-to-cart .gcu-upload-wrapper,
.woocommerce-sticky-atc .gcu-upload-wrapper,
.woocommerce-product-sticky-summary .gcu-upload-wrapper,
[class*="sticky"] .gcu-upload-wrapper {
    display: none !important;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 480px) {
    .gcu-dropzone { padding: 12px 14px; }
    .gcu-dropzone-sub { display: none; }
}
