/* Custom styles for Bank Account Manager */

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Ensure number inputs display raw numbers without formatting */
input[type="number"], input[type="text"][inputmode="numeric"] {
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    font-family: 'Courier New', monospace; /* Use monospace font for better number alignment */
}

/* Remove spinner arrows from number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type="number"] {
    -moz-appearance: textfield;
}

/* Style for formatted number inputs */
input[type="text"][inputmode="numeric"] {
    text-align: right; /* Right-align numbers for better readability */
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out;
}

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

/* Force solid colors for all card headers and modal headers */
.card-header,
.modal-header,
.card .card-header,
.modal .modal-header,
div.card-header,
div.modal-header {
    background-color: #0c3d74 !important;
    background: #0c3d74 !important;
    background-image: none !important;
    background-image: linear-gradient(none) !important;
    color: white !important;
    border-radius: 10px 10px 0 0 !important;
    border: none !important;
}

/* Additional rule to prevent any gradients */
*[class*="card-header"],
*[class*="modal-header"] {
    background-image: none !important;
    background: #0c3d74 !important;
}

/* Transfer button and badge styling */
.btn-primary[onclick*="transfer"],
button[onclick*="transfer"] {
    background-color: #0000FF !important;
    background: #0000FF !important;
    border-color: #0000FF !important;
}

.btn-primary[onclick*="transfer"]:hover,
button[onclick*="transfer"]:hover {
    background-color: #0000CC !important;
    background: #0000CC !important;
    border-color: #0000CC !important;
}

.badge.bg-primary {
    background-color: #0000FF !important;
    background: #0000FF !important;
}

/* Transfer modal styling */
.modal-title.text-primary {
    color: #0000FF !important;
}

/* Transfer add button in modal - simplified approach */
#addTransactionModal .modal-footer .btn-primary {
    background-color: #0000FF !important;
    background: #0000FF !important;
    border-color: #0000FF !important;
}

#addTransactionModal .modal-footer .btn-primary:hover {
    background-color: #0000CC !important;
    background: #0000CC !important;
    border-color: #0000CC !important;
}

.btn-primary {
    background-color: #0c3d74;
    border: none;
    border-radius: 25px;
    padding: 10px 25px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(12, 61, 116, 0.4);
}

.btn-success {
    background-color: #0f9d59;
    border: none;
    border-radius: 25px;
    padding: 10px 25px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(15, 157, 89, 0.4);
}

.form-control,
.form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 12px 15px;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #0c3d74;
    box-shadow: 0 0 0 0.2rem rgba(12, 61, 116, 0.25);
}

.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-footer {
    border: none;
    border-radius: 0 0 15px 15px;
}

.text-success {
    color: #0f9d59 !important;
    font-weight: bold;
}

.text-danger {
    color: #ef1506 !important;
    font-weight: bold;
}

.badge {
    font-size: 0.8rem;
    padding: 8px 12px;
    border-radius: 20px;
}

.spinner-border {
    color: #0c3d74;
}

.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
}

/* Card container overflow fix */
.card-body {
    overflow-x: auto;
    overflow-y: visible;
}

.card-body::-webkit-scrollbar {
    height: 4px;
}

.card-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.card-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.card-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.card-body .text-primary {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Transaction row styles */
.border-bottom {
    transition: background-color 0.2s ease;
}

.border-bottom:hover {
    background-color: #f8f9fa;
}

/* Transaction buttons styling - make them smaller and more compact */
.btn-group .btn {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    border-radius: 6px !important;
    margin: 0 2px !important;
}

.btn-group .btn i {
    font-size: 0.7rem !important;
    margin-right: 4px !important;
}

/* Mobile-first responsive design */
@media (max-width: 576px) {
    /* Container adjustments */
    .container {
        padding: 0 10px;
    }
    
    /* Card adjustments */
    .card {
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        border-radius: 8px 8px 0 0 !important;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    /* Transaction buttons - stack vertically on mobile */
    .btn-group {
        flex-direction: column !important;
        width: 100% !important;
        margin-top: 0.5rem;
    }
    
    .btn-group .btn {
        width: 100% !important;
        margin: 2px 0 !important;
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }
    
    /* Card header layout adjustments */
    .card-header.d-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .card-header h5 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Transaction list responsive */
    .border-bottom {
        padding: 0.25rem 0 !important;
    }
    
    .border-bottom .col-md-2,
    .border-bottom .col-md-1 {
        margin-bottom: 0.1rem;
        font-size: 0.8rem;
        padding: 0.1rem 0.25rem;
    }
    
    /* Transaction row mobile layout - compact */
    .border-bottom .row {
        margin: 0;
    }
    
    .border-bottom .col-6 {
        padding: 0.1rem 0.25rem;
        display: inline-block;
        width: 50%;
        vertical-align: top;
    }
    
    .border-bottom .col-12 {
        padding: 0.25rem 0.5rem;
        text-align: center;
        border-top: 1px solid #f0f0f0;
        margin-top: 0.25rem;
    }
    
    /* Transaction labels for mobile - smaller */
    .border-bottom .col-6::before,
    .border-bottom .col-12::before {
        content: attr(data-label);
        display: block;
        font-size: 0.6rem;
        color: #6c757d;
        font-weight: 600;
        text-transform: uppercase;
        margin-bottom: 0.1rem;
        line-height: 1;
    }
    
    /* Compact transaction content */
    .border-bottom strong {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    .border-bottom .badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
    
    .border-bottom small {
        font-size: 0.65rem;
        line-height: 1.1;
    }
    
    /* Action buttons mobile */
    .border-bottom .btn-group-sm .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }
    
    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 0.75rem 1rem;
        border-radius: 8px 8px 0 0 !important;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
        border-radius: 0 0 8px 8px;
    }
    
    /* Form controls */
    .form-control,
    .form-select {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    /* Account selection responsive */
    .card-header small {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }
    
    /* Account selection checkboxes mobile */
    .form-check {
        margin-bottom: 0.5rem;
        padding-left: 1.5rem;
    }
    
    .form-check-input {
        margin-top: 0.1rem;
    }
    
    .form-check-label {
        font-size: 0.85rem;
        line-height: 1.2;
    }
    
    /* Hide desktop-only elements on mobile */
    .d-md-block {
        display: none !important;
    }
    
    /* Show mobile-only elements */
    .d-mobile-only {
        display: block !important;
    }
}

/* Tablet adjustments */
@media (min-width: 577px) and (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Transaction buttons - smaller on tablet */
    .btn-group .btn {
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
    }
    
    .btn-group .btn i {
        font-size: 0.65rem !important;
        margin-right: 3px !important;
    }
    
    /* Card header adjustments */
    .card-header.d-flex {
        flex-direction: row !important;
        align-items: center !important;
    }
    
    .card-header h5 {
        font-size: 1.1rem !important;
    }
}

/* Desktop adjustments */
@media (min-width: 769px) {
    /* Transaction buttons - compact but readable */
    .btn-group .btn {
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
    }
    
    .btn-group .btn i {
        font-size: 0.75rem !important;
        margin-right: 6px !important;
    }
    
    /* Hide mobile-only elements on desktop */
    .d-mobile-only {
        display: none !important;
    }
    
    /* Show desktop-only elements */
    .d-md-block {
        display: block !important;
    }
    
    /* Transaction labels - hide on desktop */
    .border-bottom .col-md-2::before,
    .border-bottom .col-md-1::before,
    .border-bottom .col-6::before,
    .border-bottom .col-12::before {
        display: none !important;
    }
    
    /* Transaction row desktop layout - prevent overflow */
    .border-bottom .col-md-2,
    .border-bottom .col-md-1 {
        padding: 0.4rem 0.3rem;
        border-bottom: none;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Action buttons desktop - ensure they fit within card */
    .border-bottom .col-md-1:last-child {
        min-width: 90px;
        max-width: 90px;
        padding: 0.3rem 0.2rem;
        text-align: center;
    }
    
    .border-bottom .btn-group-sm {
        width: 100%;
        display: flex;
        justify-content: center;
    }
    
    .border-bottom .btn-group-sm .btn {
        padding: 0.2rem 0.3rem;
        font-size: 0.7rem;
        flex: 1;
        min-width: 35px;
    }
    
    /* Ensure transaction content doesn't overflow */
    .border-bottom strong,
    .border-bottom .badge,
    .border-bottom small {
        font-size: 0.75rem;
        line-height: 1.1;
    }
    
    /* Description column - truncate long text */
    .border-bottom .col-md-2:nth-last-child(2) {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Account column - ensure it fits */
    .border-bottom .col-md-2:first-child {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Category column - ensure it fits */
    .border-bottom .col-md-2:nth-child(4) {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Loading animation */
@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}