/* Custom styles for HisaabKitaab */

/* Form Validation */
.was-validated .form-control:invalid,
.form-control.is-invalid,
.was-validated .form-select:invalid,
.form-select.is-invalid,
#participants-container.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-control:invalid:focus,
.form-control.is-invalid:focus,
.was-validated .form-select:invalid:focus,
.form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated .form-control:invalid ~ .invalid-tooltip,
.form-control.is-invalid ~ .invalid-feedback,
.form-control.is-invalid ~ .invalid-tooltip,
.was-validated .form-select:invalid ~ .invalid-feedback,
.was-validated .form-select:invalid ~ .invalid-tooltip,
.form-select.is-invalid ~ .invalid-feedback,
.form-select.is-invalid ~ .invalid-tooltip,
#participants-container.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Custom checkbox validation */
#participants-container.is-invalid {
    border: 1px solid #dc3545;
    border-radius: 0.375rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

/* Animation for form elements */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Participant Details Page */
.participant-card .card-header {
    background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
    border-bottom: none;
}

.participant-card .card-body {
    padding: 2rem;
}

.financial-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.financial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.financial-card .card-body {
    padding: 1.5rem;
}

.financial-card h4 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.financial-card small {
    font-size: 0.8rem;
    color: #6c757d;
}

.transaction-item {
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.transaction-item:hover {
    background-color: #f8f9fa;
    border-left-color: var(--primary-color);
}

.empty-state {
    padding: 2rem 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.empty-state .empty-state-icon {
    margin-bottom: 1.5rem;
    color: #adb5bd;
}

.empty-state h5 {
    color: #343a40;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.empty-state p {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

.empty-state .btn {
    min-width: 180px;
}

.transaction-item .transaction-amount {
    font-weight: 600;
}

.transaction-item .transaction-date {
    font-size: 0.8rem;
    color: #6c757d;
}

.transaction-item .transaction-description {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.balance-positive {
    color: var(--success-color);
}

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

.balance-neutral {
    color: var(--secondary-color);
}

/* Smooth scrolling and focus styles */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px; /* Account for fixed header */
}

/* Focus styles for interactive elements */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex="0"]:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.3);
    border-radius: 3px;
    transition: outline-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* Remove default focus styles for mouse users but keep for keyboard */
:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Enhanced focus-visible styles */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.3);
    border-radius: 3px;
}

:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #4bb543;
    --danger-color: #ff3333;
    --warning-color: #ffd700;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --transition: all 0.3s ease;
}

body {
    background-color: #f5f7ff;
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

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

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

/* Gradient overlay for better text readability */
.card.bg-primary::before,
.card.bg-success::before,
.card.bg-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 0;
}

.card .card-body {
    position: relative;
    z-index: 1;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(67, 97, 238, 0.15);
    border-color: rgba(67, 97, 238, 0.2);
}

/* Icon circle for dashboard cards */
.icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.card:hover .icon-circle {
    transform: scale(1.1);
    background-color: rgba(255, 255, 255, 0.3);
}

/* Card title styles */
.card-title {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
    font-weight: bold;
}

.dashboard-card {
    text-align: center;
    padding: 30px 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    z-index: 1;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(67, 97, 238, 0.05));
    z-index: -1;
    opacity: 0;
    transition: var(--transition);
}

.dashboard-card:hover::before {
    opacity: 1;
}

.dashboard-card .icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
    transition: var(--transition);
    display: inline-block;
}

.dashboard-card:hover .icon {
    transform: scale(1.1) rotate(5deg);
    color: var(--secondary-color);
}

.dashboard-card .count {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 10px 0;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: var(--transition);
}

.dashboard-card .label {
    font-size: 1.1rem;
    color: #6c757d;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.table th {
    background-color: #f1f1f1;
}

/* Button styles */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 0.5rem 1.2rem;
    font-weight: 500;
    text-transform: none;
    transition: all 0.3s ease;
    transform: translateZ(0); /* Force hardware acceleration */
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Ripple effect for buttons */
.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.7);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Hover and active states */
.btn:not(:disabled):not(.disabled) {
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border: none;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
}

.btn-action {
    margin-right: 8px;
    margin-bottom: 5px;
    border-radius: 6px;
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
}

.btn-action i {
    margin-right: 5px;
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.6rem 1rem;
    border: 1px solid #e0e0e0;
    transition: var(--transition);
    font-size: 0.95rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}

.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.participant-badge {
    margin-right: 5px;
    margin-bottom: 5px;
}

.expense-detail {
    background-color: #f8f9fa;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
}

.balance-positive {
    color: #198754;
    font-weight: bold;
}

.balance-negative {
    color: #dc3545;
    font-weight: bold;
}

.balance-neutral {
    color: #6c757d;
}

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Focus styles for better accessibility */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.2);
}

/* Skip to main content link */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 1em;
    background-color: var(--primary-color);
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.skip-to-content:focus {
    left: 50%;
    transform: translateX(-50%);
    opacity: 1;
    text-decoration: none;
}

/* Scroll animation for dashboard cards */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.6s ease-out forwards;
}

.animate-slide-right {
    animation: slideInRight 0.6s ease-out forwards;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    margin: 20px 0;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .dashboard-card {
        margin-bottom: 20px;
    }
    
    .dashboard-card .icon {
        font-size: 3rem;
    }
    
    .dashboard-card .count {
        font-size: 2rem;
    }
    
    .dashboard-card .label {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .dashboard-card {
        padding: 25px 15px;
    }
    
    .dashboard-card .icon {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }
    
    .dashboard-card .count {
        font-size: 1.8rem;
    }
    
    .dashboard-card .label {
        font-size: 0.95rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
}

/* Dashboard Cards */
.dashboard-card {
    transition: all 0.3s ease;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-card .card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dashboard-card .card-body > div {
    flex: 1;
}

.dashboard-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.dashboard-card:hover::after {
    opacity: 1;
}

/* Card Title */
.dashboard-card .card-title {
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 0.75rem !important;
}

/* Card Value */
.dashboard-card .h2 {
    font-weight: 600;
    margin-bottom: 0;
    font-size: 2rem;
}

/* Make sure text remains clickable */
.dashboard-card * {
    position: relative;
    z-index: 1;
}

/* Disable hover effect when clicking on buttons inside the card */
.dashboard-card .btn:hover {
    transform: none !important;
}

/* Table Styling */
.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 500;
    padding: 15px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

/* Card Header Styling */
.card-header {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 500;
    padding: 15px 20px;
    border: none;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.card-header i {
    margin-right: 10px;
}
