/**
 * Corporate Events Suite - UI Components
 * Toast notifications, spinners, animations
 */

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

.cer-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.cer-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 280px;
    max-width: 420px;
    pointer-events: auto;
    animation: cerToastIn 0.3s ease-out forwards;
    transform: translateX(100%);
    opacity: 0;
}

.cer-toast.cer-toast-out {
    animation: cerToastOut 0.25s ease-in forwards;
}

@keyframes cerToastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes cerToastOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.cer-toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.cer-toast-content {
    flex: 1;
}

.cer-toast-title {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 2px;
}

.cer-toast-message {
    font-size: 13px;
    color: #64748b;
}

.cer-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    line-height: 1;
    transition: color 0.15s;
}

.cer-toast-close:hover {
    color: #475569;
}

/* Toast types */
.cer-toast-success .cer-toast-icon {
    background: #dcfce7;
    color: #16a34a;
}

.cer-toast-error .cer-toast-icon {
    background: #fee2e2;
    color: #dc2626;
}

.cer-toast-warning .cer-toast-icon {
    background: #fef3c7;
    color: #d97706;
}

.cer-toast-info .cer-toast-icon {
    background: #dbeafe;
    color: #2563eb;
}

/* Progress bar */
.cer-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    border-radius: 0 0 10px 10px;
    animation: cerToastProgress 4s linear forwards;
}

@keyframes cerToastProgress {
    from { width: 100%; }
    to { width: 0%; }
}


/* ==========================================
   LOADING SPINNER
   ========================================== */

.cer-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: cerSpin 0.7s linear infinite;
}

.cer-spinner-sm {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

.cer-spinner-lg {
    width: 28px;
    height: 28px;
    border-width: 3px;
}

.cer-spinner-white {
    border-color: rgba(255,255,255,0.3);
    border-top-color: #fff;
}

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

/* Button with spinner */
.button.cer-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.button.cer-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: cerSpin 0.7s linear infinite;
}

.button.button-primary.cer-loading::after {
    border-color: rgba(255,255,255,0.3);
    border-top-color: #fff;
}

/* Overlay spinner */
.cer-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: inherit;
}

.cer-loading-overlay .cer-spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
}


/* ==========================================
   SUCCESS ANIMATIONS
   ========================================== */

/* Checkmark animation */
.cer-success-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #dcfce7;
    border-radius: 50%;
    animation: cerSuccessPop 0.4s ease-out forwards;
}

.cer-success-check svg {
    width: 24px;
    height: 24px;
    stroke: #16a34a;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.cer-success-check svg path {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: cerCheckDraw 0.4s ease-out 0.2s forwards;
}

@keyframes cerSuccessPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes cerCheckDraw {
    to { stroke-dashoffset: 0; }
}

/* Row success flash */
.cer-row-success {
    animation: cerRowFlash 0.6s ease-out;
}

@keyframes cerRowFlash {
    0% { background-color: #dcfce7; }
    100% { background-color: transparent; }
}

/* Seat assignment success */
.cer-seat.cer-just-assigned {
    animation: cerSeatPulse 0.5s ease-out;
}

@keyframes cerSeatPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    50% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Button success state */
.button.cer-btn-success {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #fff !important;
    transition: all 0.2s;
}

.button.cer-btn-success::before {
    content: '✓ ';
}


/* ==========================================
   STATS DASHBOARD
   ========================================== */

.cer-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.cer-stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.cer-stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.cer-stat-label {
    font-size: 13px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cer-stat-card.cer-stat-total .cer-stat-value { color: #1e293b; }
.cer-stat-card.cer-stat-checked .cer-stat-value { color: #16a34a; }
.cer-stat-card.cer-stat-remaining .cer-stat-value { color: #dc2626; }
.cer-stat-card.cer-stat-percent .cer-stat-value { color: #2563eb; }

/* Progress bar */
.cer-progress-wrap {
    margin-bottom: 24px;
}

.cer-progress-bar {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.cer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 6px;
    transition: width 0.5s ease-out;
    position: relative;
}

.cer-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    animation: cerProgressShine 2s infinite;
}

@keyframes cerProgressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.cer-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #64748b;
}

/* Company breakdown */
.cer-company-stats {
    margin-top: 20px;
}

.cer-company-stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.cer-company-stat-row:last-child {
    border-bottom: none;
}

.cer-company-stat-name {
    flex: 1;
    font-weight: 500;
}

.cer-company-stat-bar {
    width: 120px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.cer-company-stat-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.cer-company-stat-count {
    width: 60px;
    text-align: right;
    font-size: 13px;
    color: #64748b;
}


/* ==========================================
   FILTERS & SORTING
   ========================================== */

.cer-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 16px;
}

.cer-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cer-filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

.cer-filter-group select,
.cer-filter-group input {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

.cer-filter-group select:focus,
.cer-filter-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.cer-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.cer-sort-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.cer-sort-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.cer-sort-btn .sort-icon {
    font-size: 10px;
}


/* ==========================================
   ADD ATTENDEE FORM
   ========================================== */

.cer-add-attendee-section {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.cer-add-attendee-section h4 {
    margin: 0 0 12px 0;
    color: #166534;
    font-size: 15px;
}

.cer-add-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.cer-add-form .form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cer-add-form .form-field label {
    font-size: 12px;
    font-weight: 500;
    color: #166534;
}

.cer-add-form .form-field input,
.cer-add-form .form-field select {
    padding: 8px 12px;
    border: 1px solid #86efac;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.cer-add-form .form-field input:focus,
.cer-add-form .form-field select:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.cer-add-form .form-field.field-name input {
    min-width: 180px;
}

.cer-add-form .form-field.field-email input {
    min-width: 200px;
}

.cer-add-form .form-field.field-company select {
    min-width: 180px;
}

.cer-add-form .form-field.field-table select {
    min-width: 100px;
}


/* ==========================================
   BULK ACTIONS
   ========================================== */

.cer-bulk-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    margin-bottom: 16px;
}

.cer-bulk-bar.hidden {
    display: none;
}

.cer-bulk-count {
    font-weight: 600;
    color: #1e40af;
}

.cer-bulk-actions {
    display: flex;
    gap: 8px;
}

.cer-bulk-actions .button {
    padding: 6px 14px;
    font-size: 13px;
}


/* ==========================================
   DIETARY REPORT
   ========================================== */

.cer-dietary-summary {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.cer-dietary-summary h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: #1e293b;
}

.cer-dietary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.cer-dietary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
}

.cer-dietary-item.no-dietary {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.cer-dietary-name {
    font-weight: 500;
    color: #92400e;
}

.cer-dietary-item.no-dietary .cer-dietary-name {
    color: #64748b;
}

.cer-dietary-count {
    font-weight: 700;
    font-size: 18px;
    color: #b45309;
}

.cer-dietary-item.no-dietary .cer-dietary-count {
    color: #94a3b8;
}

/* Dietary email form */
.cer-dietary-email-form {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.cer-dietary-email-form h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
}

.cer-email-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.cer-email-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 20px;
    font-size: 13px;
}

.cer-email-chip .remove {
    cursor: pointer;
    color: #0284c7;
    font-weight: 600;
}

.cer-email-chip .remove:hover {
    color: #dc2626;
}

.cer-add-email-row {
    display: flex;
    gap: 8px;
}

.cer-add-email-row input {
    flex: 1;
    max-width: 300px;
}

/* ==========================================
   MANUAL ENTRY INDICATOR
   (for manually added seating entries)
   ========================================== */

.cer-manual-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 10px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    cursor: help;
}

.row-manual {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.05) 0%, transparent 20%);
}

.row-manual:hover {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.cer-avatar.manual {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* Placeholder/TBA styling */
.row-placeholder {
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 10px,
        rgba(251, 191, 36, 0.08) 10px,
        rgba(251, 191, 36, 0.08) 20px
    );
}

.cer-avatar.placeholder {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    font-size: 16px;
    font-weight: 600;
}

.cer-tba-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cer-tba-indicator {
    margin-left: 4px;
    font-size: 12px;
}
