@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    --accent-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: 1px solid rgba(255, 255, 255, 0.4);
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --bg-body: #f8fafc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 239, 125, 0.08) 0, transparent 50%),
        radial-gradient(at 50% 0%, rgba(32, 58, 67, 0.05) 0, transparent 50%),
        radial-gradient(at 100% 0%, rgba(30, 60, 114, 0.08) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    padding: 16px;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 50px;
}

/* Glassmorphism Cards */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.08);
}

/* Headers */
h1, h2, h3 {
    font-weight: 700;
    color: #0f172a;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
    background-color: white;
}

.form-control:focus {
    border-color: #203a43;
    box-shadow: 0 0 0 4px rgba(32, 58, 67, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(32, 58, 67, 0.25);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(32, 58, 67, 0.35);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

/* Header & Stat Cards */
.header-box {
    text-align: center;
    padding: 24px 0 10px 0;
}

.header-box h1 {
    font-size: 26px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.debt-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

@media(min-width: 480px) {
    .debt-summary {
        grid-template-columns: 1fr 1fr;
    }
    .full-width-stat {
        grid-column: span 2;
    }
}

.stat-card {
    background: white;
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid #f1f5f9;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.stat-card.total::after {
    background: var(--primary-gradient);
}

.stat-card.paid::after {
    background: var(--accent-gradient);
}

.stat-card.remaining::after {
    background: var(--danger-gradient);
}

.stat-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
}

.stat-card.remaining .stat-value {
    color: #e11d48;
}

.stat-card.paid .stat-value {
    color: #16a34a;
}

/* List / Log section */
.history-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 4px;
}

.payment-item {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
}

.payment-item:hover {
    border-color: #cbd5e1;
}

.payment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.payment-amount {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.payment-date {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.payment-note {
    font-size: 14px;
    color: #475569;
    background: #f8fafc;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 3px solid #64748b;
}

.payment-proof {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    max-height: 120px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
}

.payment-proof img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.payment-proof:hover img {
    transform: scale(1.05);
}

.payment-proof::before {
    content: 'Xem biên lai';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 11px;
    text-align: center;
    padding: 4px 0;
    font-weight: 600;
}

/* Image Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    max-width: 95%;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* File Input Custom styling */
.file-upload-wrapper {
    position: relative;
    width: 100%;
    margin-top: 5px;
}

.file-upload-input {
    display: none;
}

.file-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: #475569;
    background-color: white;
    transition: all 0.3s ease;
}

.file-upload-btn:hover {
    border-color: #203a43;
    color: #203a43;
    background-color: rgba(32, 58, 67, 0.02);
}

.file-upload-btn.has-file {
    border-color: #10b981;
    color: #065f46;
    background-color: rgba(16, 185, 129, 0.05);
}

.file-upload-btn svg {
    width: 20px;
    height: 20px;
}

/* Login specific styles */
.login-header {
    margin-bottom: 24px;
    text-align: center;
}

.login-header h2 {
    font-size: 28px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-secondary);
}

.error-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #dc2626;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 14px;
    text-align: center;
}

.success-alert {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #059669;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 14px;
    text-align: center;
}

/* Navigation & Utility */
.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.btn-logout {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
    background: transparent;
    border: 1px solid #cbd5e1;
    color: var(--text-secondary);
    border-radius: 8px;
}

.btn-logout:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #94a3b8;
}

/* Dialog styles */
.modal-form {
    display: none;
    position: fixed;
    z-index: 999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-form-content {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

.modal-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-form-close {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.floating-action-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(32, 58, 67, 0.3);
    cursor: pointer;
    border: none;
    font-size: 28px;
    z-index: 98;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-action-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 10px 28px rgba(32, 58, 67, 0.4);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    color: #cbd5e1;
}
