/* Global Custom Styles for Budget Application */

/* Utility Classes */
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.h-3 { height: 0.75rem; }
.h-2 { height: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-2 { gap: 0.5rem; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.text-4xl { font-size: 2.25rem; }
.text-6xl { font-size: 3.75rem; }
.text-xl { font-size: 1.25rem; }
.text-lg { font-size: 1.125rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-2xl { font-size: 1.5rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-800 { color: #1f2937; }
.text-green-600 { color: #059669; }
.text-red-600 { color: #dc2626; }
.text-orange-600 { color: #ea580c; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-orange-100 { background-color: #fed7aa; }
.bg-blue-50 { background-color: #eff6ff; }
.bg-green-50 { background-color: #f0fdf4; }
.bg-purple-50 { background-color: #faf5ff; }
.bg-blue-600 { background-color: #2563eb; }
.bg-green-600 { background-color: #059669; }
.bg-purple-600 { background-color: #9333ea; }
.text-orange-600 { color: #ea580c; }
.text-white { color: white; }
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.w-full { width: 100%; }
.flex-1 { flex: 1 1 0%; }
.max-w-md { max-width: 28rem; }
.max-h-\[90vh\] { max-height: 90vh; }
.overflow-y-auto { overflow-y: auto; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.z-50 { z-index: 50; }
.bg-black { background-color: #000000; }
.bg-opacity-50 { background-color: rgba(0, 0, 0, 0.5); }
.bg-white { background-color: #ffffff; }
.text-gray-400 { color: #9ca3af; }
.hover\:text-gray-600:hover { color: #4b5563; }
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.duration-300 { transition-duration: 300ms; }
.col-span-full { grid-column: 1 / -1; }
.last\:mb-0:last-child { margin-bottom: 0; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.min-100 { min-width: 100%; }

/* Responsive Grid */
@media (min-width: 768px) {
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 2x2 Summary Cards Grid */
.summary-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.summary-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .summary-row {
        grid-template-columns: 1fr;
    }
}

/* 2-column stats grid */
.stats-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .stats-grid-2col {
        grid-template-columns: 1fr;
    }
}

/* Smaller stat cards for card layout */
.card-body .stat-card {
    padding: 0.5rem;
}

.card-body .stat-icon {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.card-body .stat-value {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.card-body .stat-label {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Financial overview grid - 2 cards side by side */
.financial-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
    .financial-overview-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    .financial-overview-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
}

/* Budget vs Actual Grid - 2 cards side by side */
.budget-vs-actual-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .budget-vs-actual-grid {
        grid-template-columns: 1fr;
    }
}

/* Budget Comparison Grid */
.budget-comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.budget-comparison-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

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

.budget-category-header {
    margin-bottom: 1rem;
}

.budget-progress-container {
    margin-bottom: 1rem;
}

.budget-values-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.budget-value-group {
    text-align: center;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
}

.budget-value-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.budget-value-amount {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

/* Mobile Responsive for Budget Cards */
@media (max-width: 768px) {
    .budget-comparison-grid {
        grid-template-columns: 1fr;
    }
    
    .budget-values-container {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .budget-value-group {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 0.5rem 0.75rem;
    }
    
    .budget-value-label {
        margin-bottom: 0;
    }
    
    .budget-value-amount {
        font-size: 0.875rem;
    }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 640px) {
    /* Card headers */
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .card-header i {
        font-size: 0.875rem;
    }
    
    /* Card body */
    .card-body {
        padding: 0.75rem;
    }
    
    /* Add extra margin to last card for mobile */
    .card:last-child {
        margin-bottom: 2rem;
    }
    
    /* Ensure main content has enough bottom spacing */
    .main-content {
        padding-bottom: 120px !important;
    }
    
    /* Add extra padding to container on mobile */
    .container {
        padding-bottom: 1rem;
    }
    
    /* Bills page mobile improvements */
    .bill-item {
        margin-bottom: 0.75rem;
    }
    
    .bill-item .btn {
        min-height: 40px;
        font-size: 0.875rem;
    }
    
    .bill-item .btn-sm {
        min-height: 36px;
        padding: 0.5rem 0.75rem;
    }
    
    /* Reports page mobile improvements */
    .grid {
        display: grid;
    }
    
    .grid-cols-1 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .gap-4 {
        gap: 1rem;
    }
    
    .gap-6 {
        gap: 1.5rem;
    }
    
    .lg\:grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .lg\:grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    @media (min-width: 640px) {
        .sm\:grid-cols-2 {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        
        .sm\:flex-row {
            flex-direction: row;
        }
        
        .sm\:items-center {
            align-items: center;
        }
        
        .sm\:justify-between {
            justify-content: space-between;
        }
        
        .sm\:items-end {
            align-items: flex-end;
        }
        
        .sm\:w-64 {
            width: 16rem;
        }
    }
    
    @media (min-width: 1024px) {
        .lg\:grid-cols-2 {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        
        .lg\:grid-cols-4 {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }
        
        .lg\:block {
            display: block;
        }
        
        .lg\:hidden {
            display: none;
        }
    }
    
    /* Transaction table improvements */
    .table th {
        font-size: 0.875rem;
        font-weight: 600;
        color: #374151;
        padding: 1rem 0.75rem;
        border-bottom: 2px solid #e5e7eb;
    }
    
    .table td {
        padding: 0.75rem;
        border-bottom: 1px solid #f3f4f6;
        vertical-align: middle;
    }
    
    .table tbody tr:hover {
        background-color: #f9fafb;
    }
    
    .w-12 {
        width: 3rem;
    }
    
    .w-24 {
        width: 6rem;
    }
    
    .px-2\.5 {
        padding-left: 0.625rem;
        padding-right: 0.625rem;
    }
    
    .py-0\.5 {
        padding-top: 0.125rem;
        padding-bottom: 0.125rem;
    }
    
    /* Settings page improvements */
    .space-y-6 > * + * {
        margin-top: 1.5rem;
    }
    
    .space-y-4 > * + * {
        margin-top: 1rem;
    }
    
    .space-y-2 > * + * {
        margin-top: 0.5rem;
    }
    
    .md\:grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .lg\:grid-cols-4 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .lg\:col-span-1 {
        grid-column: span 1;
    }
    
    .lg\:col-span-3 {
        grid-column: span 1;
    }
    
    @media (min-width: 768px) {
        .md\:grid-cols-2 {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        
        .md\:grid-cols-3 {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }
        
        .md\:col-span-3 {
            grid-column: span 3;
        }
    }
    
    @media (min-width: 1024px) {
        .lg\:grid-cols-3 {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }
        
        .lg\:grid-cols-4 {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }
        
        .lg\:col-span-1 {
            grid-column: span 1;
        }
        
        .lg\:col-span-3 {
            grid-column: span 3;
        }
    }
    
    /* Stat cards in mobile */
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-icon {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .stat-value {
        font-size: 1.125rem;
        margin-bottom: 0.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* Form elements */
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .form-label {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }
    
    .form-control, .form-select {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    /* Transaction items */
    .transaction-item .flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .transaction-item .text-right {
        text-align: left;
        width: 100%;
    }
    
    .transaction-item .flex.gap-2 {
        justify-content: flex-start;
    }
    
    /* Bill items */
    .bill-item .flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .bill-item .text-right {
        text-align: left;
        width: 100%;
    }
    
    /* Savings goal items */
    .savings-goal-item .flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .savings-goal-item .text-right {
        text-align: left;
        width: 100%;
    }
    
    /* Budget items */
    .budget-item .flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .budget-item .text-right {
        text-align: left;
        width: 100%;
    }
    
    /* Modal adjustments */
    .max-w-md {
        max-width: 95vw;
        margin: 1rem;
    }
    
    /* Grid adjustments */
    .grid-cols-1 {
        grid-template-columns: 1fr;
    }
    
    .md\:grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .card {
        margin-bottom: 0.75rem;
    }
    
    .stat-card {
        padding: 0.5rem;
    }
    
    .stat-icon {
        font-size: 1.25rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.625rem;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .budget-comparison-card {
        padding: 1rem;
    }
    
    .budget-category-header .flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Transaction Items */
.transaction-item {
    transition: all 0.2s;
}

.transaction-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Budget Items */
.budget-item {
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.budget-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Bill Items */
.bill-item {
    transition: all 0.2s;
}

.bill-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.bill-item.urgent {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Savings Goal Items */
.savings-goal-item {
    transition: all 0.2s;
}

.savings-goal-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Compact Stat Cards */
.stat-card-compact {
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card-compact:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

.stat-icon-compact {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.stat-value-compact {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.stat-label-compact {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

/* Compact Transaction Items */
.transaction-item-compact {
    transition: all 0.2s ease;
}

.transaction-item-compact:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Inline Financial Summary */
.financial-summary-inline {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
}

.stat-card-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.stat-card-inline:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.stat-icon-inline {
    font-size: 1rem;
    flex-shrink: 0;
}

.stat-content-inline {
    min-width: 0;
}

.stat-value-inline {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

.stat-label-inline {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
    line-height: 1;
}

@media (max-width: 1024px) {
    .financial-summary-inline {
        padding: 0.75rem;
    }
    
    .stat-card-inline {
        padding: 0.375rem;
        gap: 0.375rem;
    }
    
    .stat-icon-inline {
        font-size: 0.875rem;
    }
    
    .stat-value-inline {
        font-size: 0.875rem;
    }
    
    .stat-label-inline {
        font-size: 0.625rem;
    }
}

@media (max-width: 640px) {
    .financial-summary-inline {
        padding: 0.5rem;
        margin-top: 1rem;
    }
    
    .stat-card-inline {
        flex-direction: column;
        text-align: center;
        padding: 0.5rem 0.25rem;
        gap: 0.25rem;
    }
    
    .stat-icon-inline {
        font-size: 0.75rem;
    }
    
    .stat-value-inline {
        font-size: 0.75rem;
    }
    
    .stat-label-inline {
        font-size: 0.625rem;
    }
    
    .stat-card-compact {
        padding: 0.5rem;
    }
    
    .stat-icon-compact {
        font-size: 0.875rem;
    }
    
    .stat-value-compact {
        font-size: 0.875rem;
    }
    
    .stat-label-compact {
        font-size: 0.625rem;
    }
    
    .transaction-item-compact {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
}

/* Compact Bill Items */
.bill-item-compact {
    transition: all 0.2s ease;
}

.bill-item-compact:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Compact Savings Goal Items */
.savings-goal-item-compact {
    transition: all 0.2s ease;
}

.savings-goal-item-compact:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Compact Budget Items */
.budget-item-compact {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.budget-item-compact:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

@media (max-width: 640px) {
    .bill-item-compact {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .savings-goal-item-compact {
        padding: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .budget-item-compact {
        padding: 0.5rem;
        margin-bottom: 0.75rem;
    }
}
