/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: #f5f6fa;
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: #f5f6fa;
    position: relative;
    padding-bottom: 70px;
}

/* Header Section */
.header {
    background: linear-gradient(135deg, #4a90d9 0%, #3b7dd8 50%, #2d6bc7 100%);
    padding: 16px 16px 80px 16px;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -20%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-title {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.header-icons {
    display: flex;
    gap: 6px;
}

.header-icon {
    width: 24px;
    height: 24px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: color 0.2s;
}

.header-icon:hover {
    color: #fff;
}

.header-right {
    display: flex;
    gap: 16px;
    align-items: center;
}

.header-right .header-icon {
    width: 22px;
    height: 22px;
}

/* Balance Section */
.balance-section {
    position: relative;
    z-index: 1;
    padding-left: 4px;
}

.balance-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    margin-bottom: 8px;
}

.balance-amount {
    color: #fff;
    font-size: 36px;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 6px;
    font-family: 'DIN Alternate', -apple-system, sans-serif;
}

.balance-date {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
}

/* Quick Actions Card */
.quick-actions {
    background: #fff;
    border-radius: 12px;
    margin: -50px 12px 16px 12px;
    padding: 20px 16px;
    display: flex;
    justify-content: space-around;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 2;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.action-item:hover {
    transform: translateY(-2px);
}

.action-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.action-icon svg {
    width: 40px;
    height: 40px;
    color: #4a90d9;
}

.action-badge {
    position: absolute;
    top: -2px;
    right: -8px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #fff;
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 500;
}

.action-label {
    font-size: 13px;
    color: #333;
}

/* Loan Section Title */
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    padding: 20px 16px 16px 16px;
}

/* Loan Card */
.loan-card {
    background: #fff;
    border-radius: 12px;
    margin: 0 12px 16px 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.loan-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.loan-logo {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #00a86b 0%, #00875a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loan-logo svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.loan-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.loan-details {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.loan-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.loan-detail-label {
    font-size: 12px;
    color: #999;
}

.loan-detail-value {
    font-size: 14px;
    color: #4a90d9;
    font-weight: 500;
}

.loan-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
}

.loan-used {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.loan-used-label {
    font-size: 12px;
    color: #999;
}

.loan-used-amount {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    font-family: 'DIN Alternate', -apple-system, sans-serif;
}

.loan-used-amount .currency {
    font-size: 18px;
    margin-right: 2px;
}

.loan-due {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.loan-due-label {
    font-size: 12px;
    color: #999;
}

.loan-due-date {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

/* Loan Tabs */
.loan-tabs {
    display: flex;
    border-top: 1px solid #f0f0f0;
    padding-top: 14px;
}

.loan-tab {
    flex: 1;
    text-align: center;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    padding: 4px 0;
    position: relative;
    transition: color 0.2s;
}

.loan-tab:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 14px;
    background: #e0e0e0;
}

.loan-tab:hover {
    color: #4a90d9;
}

.loan-tab.active {
    color: #4a90d9;
    font-weight: 500;
}

/* Services Section */
.services-section {
    padding: 0 12px 30px 12px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.service-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 100px;
}

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

.service-card::after {
    content: '';
    position: absolute;
    right: -10px;
    bottom: -10px;
    width: 80px;
    height: 80px;
    opacity: 0.08;
}

/* Service card background colors - alternating pattern */
.service-card:nth-child(1) {
    background: #d5e9f7;
}

.service-card:nth-child(1)::after {
    background: radial-gradient(circle, #4a90d9 0%, transparent 70%);
}

.service-card:nth-child(2) {
    background: #f5e6d3;
}

.service-card:nth-child(2)::after {
    background: radial-gradient(circle, #d9a352 0%, transparent 70%);
}

.service-card:nth-child(3) {
    background: #f5e6d3;
}

.service-card:nth-child(3)::after {
    background: radial-gradient(circle, #d9a352 0%, transparent 70%);
}

.service-card:nth-child(4) {
    background: #f5d9e6;
}

.service-card:nth-child(4)::after {
    background: radial-gradient(circle, #d9a5b8 0%, transparent 70%);
}

.service-card:nth-child(5) {
    background: #d5e9f7;
}

.service-card:nth-child(5)::after {
    background: radial-gradient(circle, #4a90d9 0%, transparent 70%);
}

.service-card:nth-child(6) {
    background: #f5d9e6;
}

.service-card:nth-child(6)::after {
    background: radial-gradient(circle, #d9a5b8 0%, transparent 70%);
}

.service-card:nth-child(7) {
    background: #f5e6d3;
}

.service-card:nth-child(7)::after {
    background: radial-gradient(circle, #d9a352 0%, transparent 70%);
}

.service-card:nth-child(8) {
    background: #f5d9e6;
}

.service-card:nth-child(8)::after {
    background: radial-gradient(circle, #d9a5b8 0%, transparent 70%);
}

.service-card:nth-child(9) {
    background: #f5d9e6;
}

.service-card:nth-child(9)::after {
    background: radial-gradient(circle, #d9a5b8 0%, transparent 70%);
}

.service-title {
    font-size: 16px;
    font-weight: 600;
    color: #4a3a28;
    margin-bottom: 8px;
}

.service-desc {
    font-size: 13px;
    color: #888;
    line-height: 1.5;
}

.service-icon {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 40px;
    height: 40px;
    opacity: 0;
    display: none;
}

.service-icon svg {
    width: 100%;
    height: 100%;
    color: #e86952;
}

/* Special service card - last one occupies left column only */
.service-card.full-width {
    grid-column: 1 / 2;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 10px 0 20px 0;
    border-top: 1px solid #f0f0f0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 0 20px;
}

.nav-item:hover {
    transform: translateY(-1px);
}

.nav-icon {
    width: 24px;
    height: 24px;
    color: #999;
}

.nav-item.active .nav-icon {
    color: #4a90d9;
}

.nav-label {
    font-size: 11px;
    color: #999;
}

.nav-item.active .nav-label {
    color: #4a90d9;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 380px) {
    .balance-amount {
        font-size: 30px;
    }
    
    .action-label {
        font-size: 12px;
    }
    
    .quick-actions {
        padding: 16px 8px;
    }
}

@media (min-width: 481px) {
    .container {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .bottom-nav {
        border-radius: 0 0 12px 12px;
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Click ripple effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(74, 144, 217, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.ripple:active::before {
    width: 200px;
    height: 200px;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-back-icon {
    width: 24px;
    height: 24px;
    color: #333;
    cursor: pointer;
}

.modal-title {
    font-size: 17px;
    font-weight: 500;
    color: #333;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.modal-header-right {
    display: flex;
    gap: 16px;
    align-items: center;
}

.modal-icon {
    width: 22px;
    height: 22px;
    color: #333;
    cursor: pointer;
}

/* Modal Content */
.modal-content {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    padding-bottom: 100px;
}

/* Detail Section Header */
.detail-section-header {
    font-size: 15px;
    color: #4a90d9;
    padding: 16px 20px;
    border-bottom: 1px solid #f5f5f5;
}

/* Detail List */
.detail-list {
    padding: 0 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 0;
    border-bottom: 1px solid #f8f8f8;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 14px;
    color: #666;
    flex-shrink: 0;
    width: 80px;
}

.detail-value {
    font-size: 14px;
    color: #333;
    text-align: right;
    flex: 1;
    line-height: 1.5;
}

.detail-value-wrapper {
    text-align: right;
    flex: 1;
}

.detail-note {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    line-height: 1.4;
}

.detail-value.highlight-orange {
    color: #e8884a;
}

.detail-value.highlight-blue {
    color: #4a90d9;
}

/* Modal Footer */
.modal-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    padding: 16px 20px 30px 20px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

.modal-btn {
    flex: 1;
    padding: 12px 8px;
    border: 1px solid #4a90d9;
    border-radius: 20px;
    background: #fff;
    color: #4a90d9;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn:hover {
    background: #4a90d9;
    color: #fff;
}

.modal-btn:active {
    transform: scale(0.98);
}
