/**
 * BoxBMS Customer Rating Site - CSS Styles
 * 
 * ⚠️ ULTRA-MINIMAL COLOR SYSTEM
 * 
 * Để thay đổi màu giao diện:
 * 1. Đổi màu chính trong Settings của BoxBMS
 * 2. Rating site sẽ tự lấy qua /api/customer-rating/theme
 * 3. PRIMARY_COLOR/SECONDARY_COLOR trong config.php chỉ là fallback khi API lỗi
 * 
 * Hệ thống màu cực kỳ đơn giản:
 * - Chỉ 2 màu theme (primary, secondary) + 1 RGB variant
 * - Backgrounds, borders, shadows dùng rgba() với opacity
 * - Không có tên màu "pink", "yellow" - hoàn toàn neutral
 * - Works với BẤT KỲ màu nào: xanh, đỏ, vàng, tím, cam, etc.
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.05) 0%, rgba(var(--primary-rgb), 0.12) 100%);
    min-height: 100vh;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Index Page Styles */
.icon-circle {
    width: 100px;
    height: 100px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(var(--primary-rgb), 0.25);
}

.card {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Back Button */
.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: white;
    color: var(--primary-color);
    transform: translateX(-5px);
}

/* Rating Container */
.rating-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 0 15px;
}

.rating-header {
    background: white;
    padding: 30px 25px;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.rating-header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.rating-header p {
    color: var(--text-light);
    font-size: 1rem;
}

.header-info {
    margin-top: 20px;
    padding: 15px;
    background: rgba(var(--primary-rgb), 0.06);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.header-info-row {
    color: var(--text-dark);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Rating Body */
.rating-body {
    background: white;
    padding: 25px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-top: -1px;
}

/* Customer Info */
.customer-info {
    margin-bottom: 30px;
}

.customer-info h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.15);
}

.staff-header-left {
    font-weight: 600;
}

.staff-datetime {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 400;
}

.staff-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.staff-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.03), white);
    border-radius: 12px;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    transition: all 0.3s ease;
}

.staff-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.15);
    transform: translateX(5px);
}

.staff-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.staff-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.staff-info {
    flex: 1;
}

.staff-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
    margin-bottom: 3px;
}

.staff-position {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Visit Date Picker */
.visit-date-section {
    margin-bottom: 26px;
}

.visit-date-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 700;
}

.visit-date-title i {
    color: var(--primary-color);
}

.visit-date-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 2px 10px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.visit-date-list::-webkit-scrollbar {
    display: none;
}

.visit-date-form {
    flex: 0 0 auto;
    margin: 0;
}

.visit-date-chip {
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 88px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 14px;
    color: var(--text-dark);
    text-decoration: none;
    background: white;
    border: 1px solid rgba(var(--primary-rgb), 0.22);
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    text-align: center;
    scroll-snap-align: start;
    transition: all 0.25s ease;
}

.visit-date-chip:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.12);
}

.visit-date-chip.active {
    color: white;
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.22);
}

.visit-date-chip.no-visit:not(.active) {
    border-style: dashed;
}

.visit-date-chip span {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.visit-date-chip small {
    color: var(--text-light);
    font-size: 0.72rem;
    line-height: 1.2;
    white-space: nowrap;
}

.visit-date-chip.active small {
    color: rgba(255, 255, 255, 0.86);
}

/* Confirmation Documents */
.confirmation-section {
    margin-bottom: 30px;
    padding: 22px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.03), white);
    border: 1px solid rgba(var(--primary-rgb), 0.18);
    border-radius: 16px;
}

.confirmation-section h3 {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
    color: var(--text-dark);
    font-size: 1.15rem;
    font-weight: 700;
}

.confirmation-section h3 small {
    color: var(--text-light);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.confirmation-group + .confirmation-group {
    margin-top: 18px;
}

.confirmation-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 700;
}

.confirmation-card {
    padding: 14px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid rgba(var(--primary-rgb), 0.16);
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.confirmation-card-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.confirmation-card-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
    font-weight: 700;
}

.confirmation-card-meta {
    margin-top: 3px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.confirmation-card-amount {
    color: var(--primary-color);
    font-weight: 800;
    white-space: nowrap;
}

.confirmation-signed-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
    font-size: 0.7rem;
    font-weight: 700;
}

.confirmation-items {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(var(--primary-rgb), 0.18);
}

.confirmation-item-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-dark);
    font-size: 0.9rem;
    line-height: 1.45;
}

.confirmation-item-line + .confirmation-item-line {
    margin-top: 5px;
}

.confirmation-item-line small {
    color: var(--text-light);
    white-space: nowrap;
}

.signature-confirmation {
    margin-top: 18px;
}

.signature-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--text-dark);
    font-weight: 700;
}

.signature-canvas-wrap {
    width: 100%;
    height: 180px;
    background: white;
    border: 2px solid rgba(var(--primary-rgb), 0.35);
    border-radius: 14px;
    overflow: hidden;
}

.signature-canvas-wrap.has-existing-signature {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.signature-canvas-wrap.is-signing {
    padding: 0;
}

.signature-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.signature-canvas[hidden] {
    display: none;
}

.signature-existing-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.signature-existing-image[hidden] {
    display: none;
}

.signature-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.signature-actions small {
    color: var(--text-light);
}

.signature-clear-btn {
    flex-shrink: 0;
    border: 1px solid rgba(var(--primary-rgb), 0.35);
    background: white;
    color: var(--primary-color);
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 700;
}

.signature-clear-btn:hover {
    background: rgba(var(--primary-rgb), 0.06);
}

/* Staff Item - Display only (no selection) */
.staff-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.03), white);
    border-radius: 12px;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    transition: all 0.3s ease;
}

/* Branch Selection */
.branch-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.branch-item .btn {
    text-align: left;
    padding: 15px;
    border-width: 2px;
    transition: all 0.3s ease;
}

.branch-item .btn:hover {
    transform: translateX(5px);
}

.btn-check:checked + .btn {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-check:checked + .btn .text-muted {
    color: rgba(255, 255, 255, 0.85) !important;
}


/* Rating Section */
.rating-section {
    text-align: center;
    margin-bottom: 25px;
    padding: 25px;
    background: linear-gradient(135deg, #fafafa, #fcfcfc);
    border-radius: 15px;
}

.rating-section h4 {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 20px;
    font-weight: 600;
}

.stars-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.star {
    font-size: 3rem;
    color: #e8e8e8;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.star:hover,
.star.active {
    color: var(--warning);
    transform: scale(1.2);
}

.star.active {
    animation: starPulse 0.5s ease;
}

@keyframes starPulse {
    0%, 100% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(1.4);
    }
}

.rating-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    min-height: 30px;
}

/* Form Controls */
.form-label {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 8px;
}

.form-control {
    border: 2px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 12px;
    padding: 12px 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.15);
}

/* Quick Notes Section */
.quick-notes-section {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.03), white);
    border-radius: 15px;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.quick-notes-title {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 15px;
    font-weight: 600;
}

.quick-notes-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-note-tag {
    padding: 5px 10px;
    background: white;
    border: 1.5px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 15px;
    font-size: 0.75rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.quick-note-tag:hover {
    border-color: var(--primary-color);
    background: #fafafa;
}

.quick-note-tag.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
}

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

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Success Message */
.success-message {
    text-align: center;
    padding: 40px 20px;
    animation: fadeInUp 0.5s ease-out;
}

.feedback-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    font-size: 3.5rem;
    animation: iconBounce 0.6s ease-out;
}

.feedback-icon.happy {
    background: linear-gradient(135deg, var(--success), #20bf6b);
    color: white;
}

.feedback-icon.sad {
    background: var(--primary-color);
    color: white;
}

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

.success-message h2 {
    color: var(--text-dark);
    font-size: 1.8rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.success-message p {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 20px;
}

/* Hotline Box */
.hotline-box {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.02), white);
    border: 2px solid var(--primary-color);
    border-radius: 15px;
    padding: 20px;
    margin-top: 25px;
}

.hotline-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.hotline-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    margin-bottom: 8px;
}

.hotline-number:hover {
    color: var(--secondary-color);
}

.hotline-note {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 576px) {
    .rating-header h1 {
        font-size: 1.5rem;
    }
    
    .star {
        font-size: 2.5rem;
    }
    
    .hotline-number {
        font-size: 1.5rem;
    }

    .visit-date-list {
        margin-right: -16px;
        padding-right: 16px;
    }

    .visit-date-chip {
        min-width: 82px;
        padding: 9px 12px;
    }

    .confirmation-section {
        padding: 16px;
    }

    .confirmation-section h3,
    .confirmation-card-main,
    .signature-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .confirmation-section h3 small,
    .confirmation-card-amount,
    .confirmation-item-line small {
        white-space: normal;
    }

    .confirmation-item-line {
        flex-direction: column;
        gap: 2px;
    }

    .signature-canvas-wrap {
        height: 160px;
    }
}

/* Loading Spinner */
.spinner-border {
    width: 1.2rem;
    height: 1.2rem;
    border-width: 2px;
}
