@import url('https://fonts.googleapis.com/css2?family=Kantumruy+Pro:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Moul&display=swap');

:root {
    --primary: #ff007f;
    /* Vibrant Pink/Red */
    --primary-light: #ff66b2;
    --secondary: #00ccff;
    /* Vibrant Cyan/Blue */
    --secondary-dark: #0099cc;
    --bg-color: #ffe6f2;
    /* Soft Pink Background */
    --card-bg: #ffffff;
    --text-main: #333;
    --text-light: #666;
    --shadow-soft: 0 10px 40px rgba(255, 105, 180, 0.2);
    /* Pinkish shadow */
    --shadow-glow: 0 0 20px rgba(255, 0, 127, 0.4);
    --border-radius: 25px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Kantumruy Pro', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    padding: 20px;
    font-size: 18px;
    /* Increased base font size */
    background-image: radial-gradient(circle at top right, #ffccd5 0%, transparent 40%),
        radial-gradient(circle at bottom left, #cceeff 0%, transparent 40%);
    background-attachment: fixed;
}

.main-container {
    max-width: 98%;
    margin: 0 auto;
}

/* --- HEADER --- */
header {
    margin-bottom: 40px;
    text-align: center;
}

.logo-section h1 {
    font-family: 'Moul', serif;
    /* Khmer heavy font */
    font-size: 2.5rem;
    color: var(--primary);
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1), 0 0 20px rgba(255, 0, 127, 0.3);
    margin-bottom: 20px;
}

.welcome-text {
    font-family: 'Moul', serif;
    font-size: 1.8rem;
    color: var(--primary);
    /* Matched to Primary Pink */
    margin-top: -10px;
    margin-bottom: 25px;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.8);
}

.couple-names {
    background: white;
    padding: 15px 40px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-soft);
    border: 3px solid white;
    background-clip: padding-box;
    position: relative;
    margin-bottom: 20px;
}

.couple-names input {
    font-family: 'Moul', serif;
    font-size: 1.8rem;
    color: var(--primary);
    border: none;
    text-align: center;
    width: 250px;
    background: transparent;
    outline: none;
}

.name-input::placeholder {
    color: #ffb3d9;
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 400;
}

/* --- RESET BUTTON --- */
.header-actions {
    margin-top: 20px;
}

.btn-reset {
    background: #ff4d4d;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 77, 77, 0.3);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-reset:hover {
    background: #ff3333;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 77, 77, 0.4);
}

.btn-reset:active {
    transform: translateY(0);
}

.btn-export {
    background: #217346;
    /* Excel Green */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(33, 115, 70, 0.3);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-export:hover {
    background: #1e6a40;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 115, 70, 0.4);
}

.btn-export:active {
    transform: translateY(0);
}

/* --- DASHBOARD STYLES --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.dashboard-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 15px;
    border: 1px solid #eee;
}

.dashboard-section h3 {
    font-size: 1rem;
    color: #555;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.location-stat-item {
    margin-bottom: 12px;
}

.location-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.stat-bar-container {
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ff99cc);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.dashboard-total-item {
    padding: 10px;
    background: white;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary);
}

.dashboard-total-item.riel {
    border-left-color: #f59f00;
}

.dashboard-total-item span {
    display: block;
    font-size: 0.75rem;
    color: #888;
}

.dashboard-total-item strong {
    font-size: 1.1rem;
    color: #333;
}

@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.heart-icon {
    font-size: 3rem;
    color: #ff3333;
    filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.5));
    animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.3);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.15);
    }

    60% {
        transform: scale(1);
    }
}

.header-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.action-btn {
    border: none;
    padding: 12px 25px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.action-btn:nth-child(1) {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
}

/* QR - Purple */
.file-actions .action-btn:nth-child(1) {
    background: linear-gradient(135deg, #ff6b81, #ff4757);
}

/* Backup - Pink */
.file-actions .action-btn:nth-child(2) {
    background: linear-gradient(135deg, #2ed573, #7bed9f);
}

/* Restore - Green */
.file-actions .action-btn:nth-child(3) {
    background: linear-gradient(135deg, #ffa502, #eccc68);
    color: #333;
}

/* Excel - Orange */

/* --- STATS --- */
.stats-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 100%;
    max-width: 500px;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.icon-box {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.icon-box.blue {
    background: linear-gradient(135deg, #00c6ff, #0072ff);
}

.icon-box.green {
    background: linear-gradient(135deg, #11998e, #38ef7d);
}

.icon-box.yellow {
    background: linear-gradient(135deg, #f7971e, #ffd200);
}

.icon-box.purple {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
}

.stat-info {
    text-align: right;
}

.stat-info h3 {
    font-size: 1.1rem;
    color: #999;
    font-weight: 600;
}

.stat-info p {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

/* --- CONTENT --- */
.content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* --- FORM --- */
.form-section {
    background: white;
    padding: 35px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    /* Removed sticky positioning as it's now on top */
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.form-section h2 {
    font-family: 'Moul', serif;
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--primary);
    /* Changed to Pink */
    display: flex;
    align-items: center;
    gap: 15px;
}

.input-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1.3rem;
    /* Increased size */
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #eee;
    background: #fdfdfd;
    font-size: 1.1rem;
    font-family: 'Kantumruy Pro', sans-serif;
    transition: all 0.3s;
}

input:focus,
textarea:focus {
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 5px rgba(255, 105, 180, 0.15);
    /* Pink focus ring */
    outline: none;
}

textarea {
    resize: none;
}

/* Gender */
.gender-options {
    display: flex;
    gap: 20px;
}

.radio-custom {
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #eee;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.radio-label input:checked+.radio-custom.male {
    background: #e6f7ff;
    color: #0099cc;
    border-color: #0099cc;
    box-shadow: 0 5px 10px rgba(0, 153, 204, 0.2);
}

.radio-label input:checked+.radio-custom.female {
    background: #fff0f5;
    color: #ff3377;
    border-color: #ff3377;
    box-shadow: 0 5px 10px rgba(255, 51, 119, 0.2);
}

/* Chips */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

.chip {
    background: #f0f0f0;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}

.chip:hover {
    background: #e0e0e0;
}

.chip .delete-icon {
    font-size: 1.2rem;
    margin-left: 5px;
    color: #aaa;
}

.chip .delete-icon:hover {
    color: red;
}

/* Buttons */
.submit-btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #ff66b2, #ff007f);
    /* Pink Gradient */
    color: white;
    font-size: 1.3rem;
    font-family: 'Moul', serif;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(255, 0, 127, 0.3);
    /* Pink shadow */
    transition: all 0.2s;
    margin-top: 15px;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(255, 0, 127, 0.45);
}

.quick-amounts button {
    padding: 8px 12px;
    font-weight: bold;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
}

.quick-amounts button:hover {
    background: #f0f0f0;
}

/* --- LIST --- */
.list-section {
    background: white;
    padding: 35px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.list-header h2 {
    font-family: 'Moul', serif;
    font-size: 1.8rem;
    color: var(--primary);
    /* Changed to Pink */
}

.search-box {
    position: relative;
    width: 350px;
}

.search-box input {
    padding-left: 45px;
    border-radius: 30px;
    font-size: 1.1rem;
}

.search-box i.bx-search {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    color: #aaa;
}

/* Table */
.table-container {
    max-height: 700px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 30px;
    font-family: 'Moul', serif;
    color: var(--primary);
    /* Use Primary Color for Text */
    background: #fff5f8;
    /* Very soft pink background */
    border-bottom: 3px solid var(--secondary);
    /* Accent border */
    font-size: 1.4rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    /* Soft shadow */
}

tbody td {
    padding: 30px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 1.5rem;
    font-weight: 500;
}

tr:hover {
    background-color: #fcfcfc;
}

.gender-badge {
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.gender-badge.male {
    background: #e6f7ff;
    color: #0099cc;
}

.gender-badge.female {
    background: #fff0f5;
    color: #ff3377;
}

.amount-usd {
    font-weight: 800;
    color: #00b894;
    font-size: 1.2rem;
}

.amount-riel {
    font-weight: 800;
    color: #0984e3;
    font-size: 1.2rem;
}

/* Actions */
.view-btn,
.edit-btn,
.delete-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    margin-right: 5px;
    transition: transform 0.2s;
}

.view-btn {
    background: #f0f0f0;
    color: #555;
}

.edit-btn {
    background: #fffbe6;
    color: #faad14;
}

.delete-btn {
    background: #fff1f0;
    color: #ff4d4f;
}

.view-btn:hover,
.edit-btn:hover,
.delete-btn:hover {
    transform: scale(1.15);
}

/* Modal specific buttons - Override square buttons */
.modal-actions button {
    width: auto !important;
    height: auto !important;
    padding: 10px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #ff66b2, #ff007f);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(255, 0, 127, 0.3);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 127, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
    border: 1px solid #d9d9d9;
    font-weight: 600;
}

.btn-secondary:hover {
    background: #e6e6e6;
    color: #333;
    border-color: #d9d9d9;
}

.modal-actions .delete-btn {
    background: #ff4d4f;
    color: white;
}

.modal-actions .delete-btn:hover {
    background: #ff7875;
}

/* --- RESPONSIVE --- */
@media (max-width: 1100px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .form-section {
        margin-bottom: 30px;
    }
}

/* Modal System */
.modal-overlay,
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    /* Ensure it's on top of everything */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    /* Nice blur effect */
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    position: relative;
    z-index: 10001;
    /* Content above overlay */
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    right: 25px;
    top: 25px;
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
}

.close-btn:hover {
    color: red;
}

/* Success Popup */
.popup-notification {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #00b894;
    color: white;
    padding: 20px 40px;
    border-radius: 50px;
    box-shadow: 0 15px 30px rgba(0, 184, 148, 0.4);
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000;
}

.popup-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* --- LIST HEADER ACTIONS --- */
.list-header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.action-buttons-group {
    display: flex;
    gap: 10px;
}

.action-btn.small-btn {
    width: auto;
    /* Allow auto width */
    height: 45px;
    padding: 0 15px;
    /* Add padding */
    justify-content: center;
    border-radius: 12px;
    font-size: 1rem;
    /* Smaller font for text */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    /* Space between icon and text */
}

.action-btn.small-btn i {
    font-size: 1.4rem;
    /* Icon size */
}

/* Specific Colors for Small Buttons */
.qr-btn {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
}

.backup-btn {
    background: linear-gradient(135deg, #ff6b81, #ff4757);
}

.restore-btn {
    background: linear-gradient(135deg, #2ed573, #7bed9f);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.excel-btn {
    background: linear-gradient(135deg, #ffa502, #eccc68);
    color: #333;
}

/* Tooltip on hover (optional simplified) */
.small-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Icon Only Button */
.btn-icon-only {
    background: none;
    border: none;
    font-size: 2.5rem;
    color: var(--primary);
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
}

.btn-icon-only:hover {
    transform: scale(1.2);
    color: var(--primary-light);
}

.add-location-wrapper {
    display: flex;
    justify-content: flex-start;
}

/* --- UPPER SECTION (QR + FORM) --- */
.upper-section {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: center;
    /* Center the content */
}

.qr-section {
    flex: 1;
    /* Equal width */
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    text-align: center;
    position: sticky;
    top: 20px;
    height: fit-content;
    /* Don't stretch height unnecessarily */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.qr-section h2 {
    font-family: 'Moul', serif;
    font-size: 1.8rem;
    /* Increased size */
    margin-bottom: 25px;
}

.qr-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.qr-card p {
    font-family: 'Kantumruy Pro', sans-serif;
    color: #666;
    font-size: 1.1rem;
}

.form-section {
    flex: 1;
    /* Equal width */
    max-width: none;
    /* Remove max-width limit */
}

/* Responsive adjustment for upper section */
@media (max-width: 900px) {
    .upper-section {
        flex-direction: column;
    }

    .qr-section {
        width: 100%;
        position: static;
        margin-bottom: 20px;
    }
}

/* Gradient Text Utility */
.gradient-text {
    background: linear-gradient(45deg, var(--primary), #ff6b81);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}