/* Font import and global reset */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

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

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

/* Body styling */
body {
    font-family: 'Poppins', sans-serif;
    min-height: 100vh;
    background: #0a0e27;
    position: relative;
    transition: background 0.3s ease;
}

body.light-mode {
    background: #f0f4f8;
}

body.light-mode #background-section span {
    background: #e8ecf0;
}

body.light-mode #background-section::before {
    background: linear-gradient(180deg, #fff 0%, #00ff88 50%, #fff 100%);
}

/* Animated Background Section */
#background-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    overflow: hidden;
    z-index: 1;
}

#background-section::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #000 0%, #00ff88 50%, #000 100%);
    animation: gradientMove 5s linear infinite;
}

@keyframes gradientMove {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

#background-section span {
    position: relative;
    display: block;
    width: calc(6.25vw - 2px);
    height: calc(6.25vw - 2px);
    background: #0a0e27;
    z-index: 2;
    transition: background 1.5s ease;
}

#background-section span:hover {
    background: rgba(0, 255, 136, 0.3);
    transition: background 0s;
}

/* App Container */
.app-container {
    position: relative;
    z-index: 100;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    padding-top: 5rem;
}

/* Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 14, 39, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body.light-mode .navbar {
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(0, 204, 102, 0.3);
}

.nav-left,
.nav-right {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: transparent;
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 8px;
    color: #ccd6f6;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

body.light-mode .nav-btn {
    color: #2d3748;
    border-color: rgba(0, 204, 102, 0.3);
}

.nav-btn:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: #00ff88;
    color: #00ff88;
    transform: translateY(-2px);
}

body.light-mode .nav-btn:hover {
    background: rgba(0, 204, 102, 0.1);
    border-color: #00cc66;
    color: #00cc66;
}

.nav-btn i {
    font-size: 1rem;
}

#currentLang {
    font-weight: 600;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: rgba(10, 14, 39, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 255, 136, 0.3);
    animation: slideUp 0.3s ease;
    position: relative;
}

body.light-mode .modal-content {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 204, 102, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

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

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    color: #8892b0;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
}

.close-modal:hover {
    color: #00ff88;
    transform: rotate(90deg);
}

body.light-mode .close-modal {
    color: #666;
}

body.light-mode .close-modal:hover {
    color: #00cc66;
}

.modal-content h2 {
    color: #00ff88;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

body.light-mode .modal-content h2 {
    color: #00cc66;
}

.modal-content h3 {
    color: #ccd6f6;
    font-size: 1.25rem;
    margin: 1.5rem 0 1rem;
}

body.light-mode .modal-content h3 {
    color: #2d3748;
}

.modal-content p {
    color: #8892b0;
    line-height: 1.8;
    margin-bottom: 1rem;
}

body.light-mode .modal-content p {
    color: #4a5568;
}

.modal-content ul {
    list-style: none;
    padding: 0;
}

.modal-content ul li {
    color: #ccd6f6;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

body.light-mode .modal-content ul li {
    color: #2d3748;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 10px;
    color: #ccd6f6;
    transition: all 0.3s ease;
}

body.light-mode .contact-item {
    background: rgba(0, 204, 102, 0.05);
    border-color: rgba(0, 204, 102, 0.2);
    color: #2d3748;
}

.contact-item:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: #00ff88;
    transform: translateX(5px);
}

body.light-mode .contact-item:hover {
    background: rgba(0, 204, 102, 0.1);
    border-color: #00cc66;
}

.contact-item i {
    font-size: 1.5rem;
    color: #00ff88;
}

body.light-mode .contact-item i {
    color: #00cc66;
}

/* Header */
.app-header {
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 255, 136, 0.15);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

body.light-mode .app-header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 204, 102, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.logo i {
    font-size: 2.5rem;
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.logo h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, #00ff88, #00cc66);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(0, 255, 136, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(0, 255, 136, 0.15);
    transition: all 0.3s ease;
}

.summary-item:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.3);
    transform: translateY(-3px);
}

.summary-item i {
    font-size: 2rem;
    color: #00ff88;
}

.summary-item > div {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.75rem;
    color: #8892b0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ccd6f6;
}

body.light-mode .summary-label {
    color: #4a5568;
}

body.light-mode .summary-value {
    color: #2d3748;
}

body.light-mode .summary-item {
    background: rgba(0, 204, 102, 0.05);
    border-color: rgba(0, 204, 102, 0.2);
}

body.light-mode .summary-item:hover {
    background: rgba(0, 204, 102, 0.1);
    border-color: rgba(0, 204, 102, 0.4);
}

/* Navigation Tabs */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding: 0.5rem;
    background: rgba(10, 14, 39, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(0, 255, 136, 0.1);
}

.tab-navigation::-webkit-scrollbar {
    height: 5px;
}

.tab-navigation::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.tab-navigation::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 10px;
}

.tab-btn {
    flex: 1;
    min-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #8892b0;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn i {
    font-size: 1.1rem;
}

.tab-btn:hover {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.05);
}

.tab-btn.active {
    background: rgba(0, 255, 136, 0.15);
    border-color: rgba(0, 255, 136, 0.3);
    color: #00ff88;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.2);
}

/* Tab Content */
.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-pane.active {
    display: block;
}

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

/* Content Card */
.content-card {
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 255, 136, 0.15);
    border: 1px solid rgba(0, 255, 136, 0.2);
    min-height: 400px;
}

body.light-mode .content-card {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 204, 102, 0.3);
}

/* Hero Image */
.hero-image {
    width: 100%;
    height: 300px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 255, 136, 0.15);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.hero-image:hover img {
    transform: scale(1.05);
}

body.light-mode .hero-image {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 204, 102, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 255, 136, 0.15);
}

.card-header > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header i {
    font-size: 1.5rem;
    color: #00ff88;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ccd6f6;
}

body.light-mode .card-header h2 {
    color: #2d3748;
}

body.light-mode .input-group label {
    color: #2d3748;
}

body.light-mode .input-group input {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 204, 102, 0.3);
    color: #2d3748;
}

body.light-mode .input-group input:focus {
    background: rgba(0, 0, 0, 0.05);
    border-color: #00cc66;
}

body.light-mode .input-hint {
    color: #4a5568;
}

/* Form Container */
.form-container {
    max-width: 600px;
    margin: 0 auto;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #ccd6f6;
    margin-bottom: 0.5rem;
}

.input-group label i {
    color: #00ff88;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 10px;
    color: #ccd6f6;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #00ff88;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.input-group input::placeholder {
    color: #8892b0;
}

.input-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #8892b0;
    font-style: italic;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-large {
    width: 100%;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
}

.btn-small {
    padding: 0.625rem 1.25rem;
    font-size: 0.85rem;
}

.btn-primary {
    background: linear-gradient(135deg, #00ff88, #00cc66);
    color: #0a0e27;
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.5);
}

.btn-info {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.5);
}

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

/* Info Box */
.info-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
    border-radius: 12px;
    margin-bottom: 2rem;
}

.info-box i {
    font-size: 1.5rem;
    color: #2196F3;
}

.info-box p {
    color: #ccd6f6;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Expense List */
.expense-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.expense-list::-webkit-scrollbar {
    width: 6px;
}

.expense-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.expense-list::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 10px;
}

.expense-item {
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.expense-item:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.4);
    transform: translateX(5px);
}

.expense-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.expense-payer {
    font-weight: 600;
    color: #00ff88;
    font-size: 1.1rem;
}

.expense-amount {
    font-weight: 700;
    color: #ccd6f6;
    font-size: 1.25rem;
}

.expense-description {
    color: #8892b0;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.expense-shared {
    color: #8892b0;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.expense-shared strong {
    color: #ccd6f6;
}

.expense-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.expense-actions button {
    flex: 1;
}

/* Settlement List */
.settlement-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settlement-item {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 204, 102, 0.05));
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-left: 4px solid #00ff88;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.settlement-item:hover {
    border-color: #00ff88;
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.2);
    transform: translateX(5px);
}

.settlement-icon {
    font-size: 1.5rem;
    color: #00ff88;
}

.settlement-text {
    flex: 1;
    color: #ccd6f6;
    font-size: 1.05rem;
    line-height: 1.5;
}

.settlement-text .from {
    color: #ff4444;
    font-weight: 600;
}

.settlement-text .to {
    color: #00ff88;
    font-weight: 600;
}

.settlement-text .amount {
    color: #ffd700;
    font-weight: 700;
}

/* Balance Container */
.balance-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.balance-section {
    background: rgba(0, 255, 136, 0.05);
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.balance-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: #ccd6f6;
    font-size: 1.25rem;
}

.balance-section.creditors h3 {
    color: #00ff88;
}

.balance-section.debtors h3 {
    color: #ff4444;
}

.balance-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.balance-person {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.balance-person:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(3px);
}

.balance-person .name {
    color: #ccd6f6;
    font-weight: 500;
}

.balance-person .amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.balance-section.creditors .amount {
    color: #00ff88;
}

.balance-section.debtors .amount {
    color: #ff4444;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #8892b0;
}

.empty-state i {
    font-size: 4rem;
    color: rgba(0, 255, 136, 0.3);
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 0.5rem;
        padding-top: 5rem;
    }

    .navbar {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
    }

    .nav-left,
    .nav-right {
        gap: 0.25rem;
    }

    .nav-btn span {
        display: none;
    }

    .nav-btn {
        padding: 0.5rem 0.75rem;
    }

    .nav-btn i {
        font-size: 1.1rem;
    }

    #currentLang {
        display: inline;
        font-size: 0.8rem;
    }

    .app-header {
        padding: 1.5rem;
    }

    .logo {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .summary-bar {
        grid-template-columns: 1fr;
    }

    .tab-navigation {
        justify-content: flex-start;
    }

    .tab-btn {
        min-width: 120px;
    }

    .tab-btn span {
        display: none;
    }

    .tab-btn i {
        font-size: 1.3rem;
    }

    .content-card {
        padding: 1.5rem;
    }

    .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .balance-container {
        grid-template-columns: 1fr;
    }

    .expense-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .content-card {
        padding: 1rem;
    }

    .btn-large {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}
