/*************************************************************
   SmartPaw Pets Dashboard - Modern & Compact — COMPLETE & FIXED
*************************************************************/

/* ═══════════════════════════════════════════════════════════
   CONTAINER
   ═══════════════════════════════════════════════════════════ */
.sp-pets-container {
    max-width: 500px;
    margin: 30px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}


/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */
.sp-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.sp-empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.sp-empty-state h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 10px;
}

.sp-empty-state p {
    font-size: 15px;
    color: #6b7280;
    margin-bottom: 25px;
}


/* ═══════════════════════════════════════════════════════════
   CAROUSEL
   ═══════════════════════════════════════════════════════════ */
.sp-carousel-wrapper {
    position: relative !important;
    max-width: 450px;
    margin: 0 auto;
}

.sp-carousel {
    overflow: hidden;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12);
}

.sp-slides {
    display: flex !important;
    transition: transform 0.4s ease !important;
}

.sp-slide {
    min-width: 100% !important;
    padding: 35px 25px;
    box-sizing: border-box !important;
    text-align: center;
    position: relative !important;
}


/* ═══════════════════════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════════════════════ */
.sp-avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
    cursor: pointer;
}

.sp-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #e3f2fd;
}

.sp-avatar-placeholder {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    color: #ccc;
    font-weight: 700;
}

.sp-avatar-edit-icon {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: #4f46e5;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sp-avatar-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}


/* ═══════════════════════════════════════════════════════════
   PET INFO
   ═══════════════════════════════════════════════════════════ */
.sp-pet-name {
    font-size: 26px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px;
}

.sp-pet-meta {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 20px;
}


/* ═══════════════════════════════════════════════════════════
   STATS
   ═══════════════════════════════════════════════════════════ */
.sp-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.sp-stat {
    text-align: center;
}

.sp-stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    display: block;
}

.sp-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    display: block;
}


/* ═══════════════════════════════════════════════════════════
   DELIVERY INFO BOX
   ═══════════════════════════════════════════════════════════ */
.sp-delivery-box {
    background: #f9fafb;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.sp-delivery-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #374151;
    margin-bottom: 6px;
}

.sp-delivery-row strong {
    color: #4f46e5;
    font-weight: 600;
}

.sp-delivery-row:last-child {
    margin-bottom: 0;
}


/* ═══════════════════════════════════════════════════════════
   NEXT DELIVERY BOX
   ═══════════════════════════════════════════════════════════ */
.sp-next-delivery {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: 20px;
    border-radius: 16px;
    border-left: 5px solid #4caf50;
    margin-bottom: 20px;
}

.sp-next-label {
    font-size: 13px;
    color: #2e7d32;
    display: block;
    margin-bottom: 5px;
}

.sp-next-date {
    font-size: 24px;
    font-weight: 700;
    color: #1b5e20;
    display: block;
    margin-bottom: 5px;
}

.sp-next-delivery small {
    font-size: 12px;
    color: #558b2f;
    display: block;
}


/* ═══════════════════════════════════════════════════════════
   ACTION BUTTONS
   ═══════════════════════════════════════════════════════════ */
.sp-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.sp-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

.sp-btn-primary {
    background: #4f46e5;
    color: white;
}

.sp-btn-primary:hover {
    background: #4338ca;
    transform: translateY(-2px);
}

.sp-btn-confirm {
    background: #4f46e5;
    color: white;
}

.sp-btn-confirm:hover {
    background: #4338ca;
}

.sp-btn-change {
    background: white;
    color: #4f46e5;
    border: 2px solid #4f46e5;
}

.sp-btn-change:hover {
    background: #eef2ff;
}

.sp-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.sp-btn-secondary:hover {
    background: #e5e7eb;
}


/* ═══════════════════════════════════════════════════════════
   PET MANAGEMENT BUTTONS
   ═══════════════════════════════════════════════════════════ */
.sp-pet-management {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.sp-btn-icon {
    width: 40px;
    height: 40px;
    background: #f3f4f6;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    color: inherit;
}

.sp-btn-icon:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

.sp-delete-pet:hover {
    background: #fee;
}


/* ═══════════════════════════════════════════════════════════
   NAVIGATION ARROWS
   ═══════════════════════════════════════════════════════════ */
.sp-arrow {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 45px;
    height: 45px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999 !important;
    font-size: 22px;
    box-shadow: 0 4px 10px rgba(79,70,229,0.3);
    transition: all 0.25s ease;
}

.sp-arrow:hover {
    background: #4338ca;
    transform: translateY(-50%) scale(1.1);
}

.sp-arrow-prev {
    left: -60px !important;
}

.sp-arrow-next {
    right: -60px !important;
}


/* DOTS */
.sp-dots {
    text-align: center;
    margin-top: 20px;
}

.sp-dot {
    width: 10px;
    height: 10px;
    background: #d1d5db;
    border-radius: 50%;
    display: inline-block;
    margin: 0 5px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.sp-dot.active {
    background: #4f46e5;
    transform: scale(1.4);
}


/* ═══════════════════════════════════════════════════════════
   INLINE EDIT PANEL — FIXED FOR PROPER FITTING
   ═══════════════════════════════════════════════════════════ */
.sp-edit-panel {
    position: absolute;
    inset: 15px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(0,0,0,0.22);
    padding: 20px;
    z-index: 9999;
    display: none;
    animation: editShow 0.25s ease;
    box-sizing: border-box;
    overflow-y: auto;
    max-height: calc(100% - 30px);
}

.sp-edit-panel.sp-edit-open {
    display: block;
}

@keyframes editShow {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

.sp-edit-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #1f2937;
}

/* EDIT ROWS — FIXED WIDTH ISSUES */
.sp-edit-row {
    margin-bottom: 14px;
    width: 100%;
    box-sizing: border-box;
}

.sp-edit-row-inline {
    display: flex;
    gap: 12px;
}

.sp-edit-row-inline > div {
    flex: 1;
    min-width: 0;
}

.sp-edit-row label {
    font-size: 13px;
    color: #374151;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

.sp-edit-row input,
.sp-edit-row select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #fafafa;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.sp-edit-row input:focus,
.sp-edit-row select:focus {
    border-color: #4f46e5;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.sp-edit-row small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6b7280;
}

/* EDIT ACTIONS */
.sp-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.sp-edit-actions .sp-btn {
    flex: 0 0 auto;
    min-width: 100px;
}

/* ═══════════════════════════════════════════════════════════
   DELIVERY DATES PICKER — FIXED CONTAINER
   ═══════════════════════════════════════════════════════════ */
.sp-delivery-dates-picker {
    border-top: 2px solid #e5e7eb;
    padding-top: 16px;
    margin-top: 16px;
}

.sp-selected-dates-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
    box-sizing: border-box;
    width: 100%;
}

.sp-selected-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #4f46e5;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.sp-selected-date-badge .remove-date {
    background: rgba(255,255,255,0.3);
    border: none;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.sp-selected-date-badge .remove-date:hover {
    background: rgba(255,255,255,0.5);
}

.sp-date-picker-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.sp-add-date-to-pet {
    white-space: nowrap;
    flex-shrink: 0;
}

.sp-dates-counter {
    font-weight: 600;
    color: #6b7280;
}

.sp-dates-counter.complete {
    color: #28a745 !important;
}


/* ═══════════════════════════════════════════════════════════
   MODAL — FIXED CENTERING & CLOSE BUTTON
   ═══════════════════════════════════════════════════════════ */
.sp-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.65) !important;
    z-index: 999999 !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 20px;
    box-sizing: border-box;
}

.sp-modal-overlay.sp-open {
    display: flex !important;
}

.sp-modal {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    animation: modalAppear 0.25s ease;
    margin: 0 !important;
    position: relative !important;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

@keyframes modalAppear {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

.sp-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sp-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

/* FIXED: PERFECT CIRCLE CLOSE BUTTON */
.sp-modal-close {
    background: #4f46e5;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sp-modal-close:hover {
    background: #4338ca;
    transform: rotate(90deg);
}

.sp-modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

.sp-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.sp-modal-body label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}

.sp-modal-body input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    box-sizing: border-box;
}

.sp-modal-body input[type="date"]:focus {
    border-color: #4f46e5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.sp-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.sp-modal-cancel,
.sp-modal-save {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.sp-modal-cancel {
    background: #f3f4f6;
    color: #374151;
}

.sp-modal-cancel:hover {
    background: #e5e7eb;
}

.sp-modal-save {
    background: #4f46e5;
    color: white;
}

.sp-modal-save:hover {
    background: #4338ca;
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sp-arrow-prev { 
        left: 5px !important; 
    }
    
    .sp-arrow-next { 
        right: 5px !important; 
    }
    
    .sp-arrow {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .sp-slide { 
        padding: 25px 15px; 
    }

    .sp-edit-panel { 
        inset: 8px; 
        padding: 16px; 
    }
    
    .sp-edit-row-inline {
        flex-direction: column;
        gap: 14px;
    }
    
    .sp-stats {
        gap: 20px;
    }
    
    .sp-modal {
        width: 95%;
    }
}