@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Poppins', sans-serif;
    color: #e2e8f0;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    overflow-x: hidden;
    position: relative;
}

.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 8px 32px 0 rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 12px 40px 0 rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
}

.income-text {
    color: #4ade80;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

.expense-text {
    color: #f87171;
    text-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
}

.balance-text {
    color: #60a5fa;
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
}

.type-button {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.type-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        rgba(255,255,255,0.1) 0%, 
        rgba(255,255,255,0.05) 50%, 
        rgba(255,255,255,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.type-button:hover::after {
    opacity: 1;
}

.active-type {
    box-shadow: 0 0 15px currentColor;
}

.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(96, 165, 250, 0); }
    100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0); }
}

.converter-box {
    background: rgba(20, 20, 30, 0.8);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.footer {
    background: rgba(20, 20, 30, 0.7);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-text {
    position: relative;
}

.logo-text::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #4ade80, #60a5fa, #f87171);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.logo-text:hover::after {
    transform: scaleX(1);
}

/* Custom chart styles */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.thin-bars .chartjs-bar {
    border-radius: 3px;
    width: 10px !important;
}

/* Custom input styles */
input, select, textarea {
    background: rgba(30, 30, 40, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none !important;
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3) !important;
    background: rgba(30, 30, 40, 0.9) !important;
}

::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(20, 20, 30, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Calculator Modal Styles */
#calculator-modal {
    z-index: 1000;
    transition: opacity 0.3s ease;
}

#calculator-modal .glass-card {
    max-height: 90vh;
    overflow-y: auto;
}

.calculator-display {
    min-height: 60px;
    word-break: break-all;
}

.calculator-btn {
    transition: all 0.2s ease;
    font-weight: 500;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    user-select: none;
}

.calculator-btn:active {
    transform: scale(0.95);
}

/* Sum Calculator Styles */
#calculator-sum-btn {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    transition: all 0.3s ease;
}

#calculator-sum-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

#sum-input {
    background: rgba(30, 30, 40, 0.9) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
    color: white !important;
    font-family: 'Poppins', sans-serif;
}

#sum-input:focus {
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3) !important;
}

#calculate-sum {
    background: linear-gradient(135deg, #10b981, #059669);
    transition: all 0.3s ease;
    min-width: 100px;
}

#calculate-sum:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

#sum-result {
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 8px;
    border-left: 3px solid #8b5cf6;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Invoice Button Styles */
#generate-invoice {
    background: linear-gradient(135deg, #10b981, #059669);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

#generate-invoice:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

#generate-invoice::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

#generate-invoice:hover::before {
    width: 300px;
    height: 300px;
}

#generate-invoice svg {
    transition: transform 0.3s ease;
}

#generate-invoice:hover svg {
    transform: rotate(15deg) scale(1.1);
}

/* Invoice PDF Generation Animation */
@keyframes pdfProcessing {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.generating-pdf {
    animation: pdfProcessing 1s ease infinite;
    pointer-events: none;
    opacity: 0.7;
}

/* Transaction Item Delete Button */
.transaction-item {
    position: relative;
    transition: all 0.3s ease;
}

.transaction-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.delete-transaction {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.transaction-item:hover .delete-transaction {
    opacity: 1;
}

.delete-transaction:hover {
    background: rgba(239, 68, 68, 0.3);
}

.delete-transaction svg {
    width: 14px;
    height: 14px;
    color: #f87171;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header {
        margin-bottom: 2rem;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .glass-card {
        padding: 1.5rem;
    }
    
    /* Adjust transaction form layout */
    #transaction-form .flex.space-x-2 {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #transaction-form .flex.space-x-2 button {
        width: 100%;
    }
    
    /* Adjust currency converter layout */
    .converter-box .grid-cols-5 {
        grid-template-columns: 1fr 0.5fr 1fr;
    }
    
    /* Make transaction list take full width */
    #transactions-list {
        max-height: 50vh;
    }
    
    /* Adjust chart containers for mobile */
    .chart-container {
        height: 250px;
    }
    
    /* Stats panel adjustments */
    #stats-panel .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Make filter dropdowns stack vertically */
    .flex.space-x-2 {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Adjust summary card elements */
    .summary-card div {
        padding: 0.5rem 0;
    }
    
    /* Make buttons full width */
    button, #set-budget {
        width: 100%;
    }
    
    /* Adjust input fields */
    input, select, textarea {
        width: 100% !important;
    }
    
    /* Hide some decorative elements on mobile */
    .logo-text::after {
        display: none;
    }

    /* Calculator modal adjustments */
    #calculator-modal .glass-card {
        width: 95%;
        padding: 1rem;
    }

    .calculator-btn {
        padding: 0.75rem;
    }
    
    /* Sum calculator mobile adjustments */
    #calculate-sum {
        min-width: 80px;
        font-size: 0.875rem;
    }
    
    #sum-input {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }
    
    .glass-card {
        padding: 1rem;
    }
    
    /* Further reduce chart sizes */
    .chart-container {
        height: 200px;
    }
    
    /* Adjust transaction item layout */
    .transaction-item .flex.justify-between {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .transaction-item .text-right {
        text-align: left;
    }

    /* Show delete button always on mobile */
    .delete-transaction {
        opacity: 1;
    }
    
    /* Calculator adjustments for small screens */
    .calculator-btn {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    #calculator-sum-btn span {
        font-size: 0.75rem;
    }
    
    #calculator-sum-btn svg {
        width: 16px;
        height: 16px;
    }
    
    /* Invoice button adjustments */
    #generate-invoice {
        font-size: 0.875rem;
        padding: 0.75rem;
    }
}

/* Add this to your CSS */
button, input[type="submit"], input[type="button"] {
    min-height: 44px; /* Recommended minimum touch target size */
}

select, input, textarea {
    min-height: 44px;
    font-size: 16px; /* Prevent iOS zooming on focus */
}

/* Prevent zooming on input focus on mobile */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Add this to your CSS */
@media (max-width: 768px) {
    .grid-cols-1 > div {
        order: 1;
    }
    
    .grid-cols-1 > div.lg:col-span-1 {
        order: 0;
    }
}

/* PDF Invoice Styles (for the generated PDF) */
.invoice-preview {
    background: white;
    color: #1e293b;
    padding: 20px;
    font-family: 'Poppins', sans-serif;
}

.invoice-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.invoice-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
}

.invoice-date {
    color: #64748b;
    font-size: 14px;
}

.invoice-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.invoice-summary-item {
    background: #f8fafc;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.invoice-summary-label {
    color: #64748b;
    font-size: 12px;
    margin-bottom: 5px;
}

.invoice-summary-value {
    font-size: 18px;
    font-weight: 600;
}

.invoice-income {
    color: #10b981;
}

.invoice-expense {
    color: #ef4444;
}

.invoice-balance {
    color: #3b82f6;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.invoice-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 600;
    font-size: 12px;
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid #cbd5e1;
}

.invoice-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
    font-size: 12px;
}

.invoice-table tr:last-child td {
    border-bottom: none;
}

.invoice-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
}
