/* Global Styles */
:root {
    --primary-color: #6C63FF;
    --secondary-color: #4CAF50;
    --danger-color: #FF5252;
    --dark-color: #1A202C;
    --card-bg: #2D3748;
    --light-color: #F7FAFC;
    --gray-color: #A0AEC0;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --gradient-primary: linear-gradient(135deg, #6C63FF 0%, #5A54D4 100%);
    --gradient-secondary: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    --gradient-danger: linear-gradient(135deg, #FF5252 0%, #D32F2F 100%);
    --border-radius: 12px;
    --section-padding: 15px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1A202C 0%, #2D3748 100%);
    color: var(--light-color);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect fill="none" width="100" height="100"/><path d="M95,50c0,24.9-20.1,45-45,45S5,74.9,5,50S25.1,5,50,5S95,25.1,95,50z" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="1"/></svg>');
    background-size: 300px 300px;
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
}

.unified-card {
    background: rgba(45, 55, 72, 0.7);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.3), 0 10px 15px -5px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.unified-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
}

.card-header-main {
    text-align: center;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.card-header-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
}

h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--light-color);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #6C63FF 0%, #5A54D4 50%, #8A84FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

h1::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 3px;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--light-color);
    padding-bottom: 5px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    opacity: 0.9;
}

.item-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-left: 12px;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Balance Section Styles */
.balance-section {
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
    position: relative;
}

.balance-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
}

.card-top-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0;
}

.balance-header {
    font-size: 1rem;
    color: var(--gray-color);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.balance-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--light-color);
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    padding: 8px 20px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(145deg, rgba(0,0,0,0.3), rgba(0,0,0,0.1));
    letter-spacing: 1px;
}

.balance-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.balance-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.balance-trend {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
    width: fit-content;
    margin-top: 5px;
}

.trend-up {
    color: var(--secondary-color);
}

.trend-down {
    color: var(--danger-color);
}

.trend-neutral {
    color: var(--gray-color);
}

#trend-icon {
    margin-right: 10px;
    font-size: 1.2rem;
}

/* Transactions Section */
.transactions-section {
    padding: 15px 25px;
}

.transactions-section h2 {
    margin-bottom: 15px;
    text-align: center;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.transactions-section h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(108,99,255,0) 0%, rgba(108,99,255,1) 50%, rgba(108,99,255,0) 100%);
}

.transaction-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 85%;
    margin: 0 auto;
}

.transaction-item {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 12px 18px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 15px;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 2px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.transaction-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.5;
}

.transaction-item:nth-child(1)::before,
.transaction-item:nth-child(2)::before {
    background: var(--gradient-secondary);
}

.transaction-item:nth-child(3)::before,
.transaction-item:nth-child(4)::before,
.transaction-item:nth-child(5)::before {
    background: var(--gradient-danger);
}

.transaction-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.25);
}

.transaction-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
}

.item-header {
    display: flex;
    align-items: center;
}

.item-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
}

.item-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 50px;
    border-bottom-right-radius: 50px;
}

.income-icon {
    background: var(--gradient-secondary);
    color: white;
}

.expense-icon {
    background: var(--gradient-danger);
    color: white;
}

.item-stats {
    display: flex;
    flex-direction: row;
    gap: 15px;
    margin-right: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--gray-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--light-color);
}

.card-title-area {
    display: flex;
    align-items: center;
}

.card-stats {
    display: flex;
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--gray-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--light-color);
}

.card-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 12px;
}

.income-icon {
    background: var(--gradient-secondary);
    color: white;
}

.expense-icon {
    background: var(--gradient-danger);
    color: white;
}

.card-body {
    padding: 12px 15px;
}

.item-input {
    display: flex;
    align-items: center;
}

.input-group {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    height: 40px;
    width: 100%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.2);
}

.currency-symbol {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--gray-color);
    font-weight: bold;
    font-size: 0.9rem;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.amount-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--light-color);
    padding: 8px 12px;
    font-size: 0.95rem;
    outline: none;
    width: 80px;
    font-weight: 500;
}

.amount-input:focus {
    background: rgba(255, 255, 255, 0.05);
}

.amount-input::placeholder {
    color: var(--gray-color);
}

.button-group {
    display: flex;
}

.btn {
    background: none;
    border: none;
    padding: 0 12px;
    height: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--light-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::before {
    width: 150%;
    height: 150%;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.add-btn:hover {
    background-color: rgba(76, 175, 80, 0.2);
    color: var(--secondary-color);
}

.subtract-btn:hover {
    background-color: rgba(255, 82, 82, 0.2);
    color: var(--danger-color);
}

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

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 0.5s ease;
}

.history-container {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.5s ease;
}

.history-item:last-child {
    border-bottom: none;
}

.history-type {
    display: flex;
    align-items: center;
}

.history-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 0.9rem;
}

.history-details {
    flex: 1;
}

.history-category {
    font-weight: 600;
    margin-bottom: 5px;
}

.history-time {
    font-size: 0.8rem;
    color: var(--gray-color);
}

.history-amount {
    font-weight: 600;
}

.amount-positive {
    color: var(--secondary-color);
}

.amount-negative {
    color: var(--danger-color);
}

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

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 0.5s ease;
}

/* Responsive Design */
/* Large screens (default) */
@media screen and (min-width: 1200px) {
    .container {
        max-width: 1000px;
    }
}

/* Medium-sized screens */
@media screen and (max-width: 1199px) and (min-width: 992px) {
    .container {
        max-width: 900px;
    }
}

/* Tablets and small laptops */
@media screen and (max-width: 991px) and (min-width: 768px) {
    .container {
        max-width: 90%;
        padding: 15px;
    }
    
    .balance-amount {
        font-size: 2.2rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .transaction-items {
        max-width: 95%;
    }
}

/* Mobile devices (landscape) */
@media screen and (max-width: 767px) and (min-width: 576px) {
    .container {
        width: 95%;
        padding: 10px;
    }
    
    .balance-section {
        padding: 12px 15px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .balance-right {
        align-self: flex-end;
    }
    
    .balance-amount {
        font-size: 1.8rem;
        padding: 5px 15px;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    h2 {
        font-size: 1.1rem;
    }
    
    .transaction-items {
        max-width: 100%;
    }
    
    .transaction-item {
        padding: 10px 12px;
    }
    
    .item-stats {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* Small mobile devices */
@media screen and (max-width: 575px) {
    body {
        padding: 10px;
    }
    
    .container {
        width: 100%;
        padding: 0;
    }
    
    .card-header-main {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.4rem;
        letter-spacing: 2px;
    }
    
    h1::after {
        width: 40px;
        height: 2px;
    }
    
    .balance-section {
        padding: 10px;
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .balance-header {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    
    .balance-amount {
        font-size: 1.6rem;
        padding: 5px 10px;
    }
    
    .transactions-section {
        padding: 10px;
    }
    
    .transactions-section h2 {
        margin-bottom: 10px;
        font-size: 1rem;
    }
    
    .transaction-items {
        max-width: 100%;
        gap: 8px;
    }
    
    .transaction-item {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        padding: 8px 10px;
        gap: 8px;
    }
    
    .item-input {
        grid-column: 1 / -1;
    }
    
    .item-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .item-title {
        font-size: 0.9rem;
        margin-left: 8px;
    }
    
    .item-stats {
        flex-direction: row;
        gap: 10px;
        margin-right: 0;
    }
    
    .stat-label {
        font-size: 0.6rem;
    }
    
    .stat-value {
        font-size: 0.7rem;
    }
    
    .input-group {
        height: 36px;
    }
    
    .currency-symbol {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .amount-input {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .btn {
        padding: 0 8px;
        font-size: 0.8rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5A54D4;
}

/* Event Cards Styling */
.event-cards .item-icon {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
}

.event-cards::before {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
}

/* Arabic Text Support */
.item-title, h1, h2, .balance-header, .stat-label, #trend-text {
    font-family: 'Cairo', 'Segoe UI', 'Arial', sans-serif;
    direction: rtl;
}

/* RTL support for specific elements */
.item-header {
    flex-direction: row-reverse;
}

.item-stats {
    direction: rtl;
}

.stat-row {
    flex-direction: row-reverse;
}

/* Pulse animation for balance and transaction items */
.pulse {
    animation: pulse 0.5s ease;
}
