/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem 0;
    box-shadow: var(--shadow-lg);
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Search Form */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Voice Input Container */
.input-with-voice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-with-voice input {
    flex: 1;
}

/* Voice Button */
.voice-btn {
    padding: 0.75rem 1rem;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
}

.voice-btn:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

.voice-btn:active {
    transform: scale(0.95);
}

.voice-btn.listening {
    background: #ef4444;
    border-color: #ef4444;
    animation: pulse 1.5s ease-in-out infinite;
}

.voice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

.help-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Button */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-loader {
    display: inline-block;
}

/* Error Message */
.error-message {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.info-item {
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.summary-card {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: transform 0.3s;
}

.summary-card:hover {
    transform: translateY(-4px);
}

.summary-card.highlight {
    background: #fef3c7;
    border-color: var(--warning-color);
}

.summary-card.advance {
    background: #d1fae5;
    border-color: var(--success-color);
}

.summary-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.summary-label {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Chit Details */
.chit-item {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
}

.chit-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.chit-id {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.chit-status {
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chit-status.active {
    background: #d1fae5;
    color: #065f46;
}

.chit-status.completed {
    background: #dbeafe;
    color: #1e40af;
}

.chit-item-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.chit-detail {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.chit-detail:last-child {
    border-bottom: none;
}

.chit-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.chit-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Highlighted Per Period Amount */
.chit-detail.per-period-highlight {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    padding: 1.25rem;
    border-radius: 8px;
    border: 2px solid #0284c7;
    margin: 0.75rem 0;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    grid-column: 1 / -1;
}

.chit-detail.per-period-highlight .chit-label {
    font-size: 1rem;
    font-weight: 700;
    color: #0c4a6e;
    width: 100%;
}

.chit-detail.per-period-highlight .chit-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0284c7;
    width: 100%;
}

.chit-detail-note {
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #eff6ff;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

/* Payment History */
.payment-item {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--success-color);
}

.payment-info {
    flex: 1;
}

.payment-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.payment-remarks {
    color: var(--text-primary);
    font-weight: 500;
}

.payment-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success-color);
}

.payment-periods {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    margin-top: 2rem;
}

.footer p {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Responsive Design */
@media (min-width: 640px) {
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .chit-item-body {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .header h1 {
        font-size: 2.5rem;
    }

    .header .subtitle {
        font-size: 1.125rem;
    }

    .summary-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .card {
        padding: 2rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }

    .main-content {
        padding: 3rem 0;
    }
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn-loader::after {
    content: "";
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Payment Form */
.payment-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.payment-card h2 {
    color: white;
}

.payment-form-header {
    background: rgba(255, 255, 255, 0.15);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.payment-info {
    margin: 0;
    font-size: 1rem;
    line-height: 1.8;
}

.payment-form .form-group label {
    color: white;
    font-weight: 600;
}

.payment-form input,
.payment-form textarea {
    background: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.payment-form .help-text {
    color: rgba(255, 255, 255, 0.9);
}

.payment-calculation {
    background: rgba(255, 255, 255, 0.2);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.payment-calculation h4 {
    margin-bottom: 1rem;
    color: white;
}

.calc-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

.calc-row span {
    color: rgba(255, 255, 255, 0.9);
}

.calc-row strong {
    color: white;
    font-size: 1.125rem;
}

.btn-payment {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    font-weight: 700;
    margin-top: 1.5rem;
}

.btn-payment:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.payment-success-message {
    background: #d1fae5;
    border: 2px solid #6ee7b7;
    color: #065f46;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideDown 0.3s ease-out;
}

.payment-success-message::before {
    content: "✓";
    font-size: 2rem;
    color: #10b981;
}

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

/* Print Styles */
@media print {
    .header,
    .search-section,
    .footer,
    .payment-card {
        display: none;
    }

    .card {
        page-break-inside: avoid;
    }
}

/* Finish Chit Button */
.chit-item-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px dashed var(--border-color);
    text-align: center;
}

.btn-finish-chit {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.btn-finish-chit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-finish-chit.active {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

/* Maturity Section */
.maturity-section {
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s ease-out;
}

.maturity-selection-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--warning-color);
}

.maturity-selection-card h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.maturity-info {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 500;
}

/* Maturity Options */
.maturity-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.maturity-option {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
    transition: all 0.3s;
}

.maturity-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.option-header {
    margin-bottom: 1.5rem;
}

.option-header h4 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.option-rate {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
}

/* Slider Container */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.slider-container label {
    font-weight: 600;
    color: var(--text-primary);
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.maturity-slider {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: var(--bg-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.maturity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.maturity-slider::-webkit-slider-thumb:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.maturity-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.maturity-slider::-moz-range-thumb:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.slider-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 3rem;
    text-align: center;
    background: var(--bg-color);
    padding: 0.5rem;
    border-radius: 8px;
}

/* Maturity Summary */
.maturity-summary {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 2px solid var(--primary-color);
}

.maturity-summary h4 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    text-align: center;
}

.summary-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 6px;
    align-items: center;
}

.summary-row.highlight {
    background: #dbeafe;
    border: 1px solid var(--primary-color);
    font-weight: 600;
}

.summary-row.deduction {
    background: #fee2e2;
    border: 1px solid var(--danger-color);
}

.summary-row.total {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 2px solid var(--success-color);
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1rem;
}

.summary-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.summary-row.total .summary-label,
.summary-row.total .summary-value {
    color: #065f46;
}

/* Maturity Actions */
.maturity-actions {
    text-align: center;
}

.btn-submit-maturity {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    padding: 1rem 3rem;
    border: none;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-lg);
}

.btn-submit-maturity:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.btn-submit-maturity:active {
    transform: translateY(0);
}

.btn-submit-maturity:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

/* Maturity Success Message */
.maturity-success-message {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 3px solid var(--success-color);
    color: #065f46;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease-out;
}

.maturity-success-message strong {
    color: #047857;
}

/* Responsive Design for Maturity Section */
@media (min-width: 768px) {
    .maturity-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* User Info Section in Navigation */
.nav-user-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.nav-user-email {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
}

.nav-logout-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-logout-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Language Switcher in Navigation */
.language-switcher {
    display: flex;
    gap: 0.5rem;
    background: rgba(37, 99, 235, 0.1);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.header .container {
    position: relative;
}

.lang-btn {
    background: transparent;
    color: var(--text-primary);
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.lang-btn:hover {
    background: rgba(37, 99, 235, 0.15);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Home Navigation Styles */
.home-nav .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

/* Responsive adjustments for navigation user section */
@media (max-width: 768px) {
    .nav-user-section {
        padding: 0.4rem 0.75rem;
        gap: 0.5rem;
    }
    
    .nav-user-email {
        font-size: 0.75rem;
    }
    
    .nav-logout-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .lang-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 640px) {
    .home-nav .container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .nav-user-section {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }
    
    .language-switcher {
        width: 100%;
        justify-content: center;
    }
}

/* Edit Chit Styles */
.chit-detail-edit {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.chit-detail-edit label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.chit-detail-edit input {
    padding: 0.5rem;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chit-detail-edit input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chit-edit-note {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.chit-item-footer {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-edit-chit {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.btn-edit-chit:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.btn-save-chit {
    background: linear-gradient(135deg, #10b981, #059669);
}

.btn-save-chit:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-cancel-edit-chit {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-cancel-edit-chit:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Payment Edit Styles */
.payment-item {
    position: relative;
}

.payment-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.btn-edit-payment {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.btn-edit-payment:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.payment-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: #f3f4f6;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.payment-edit-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.payment-edit-form label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.payment-edit-form input {
    padding: 0.5rem;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.payment-edit-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.payment-edit-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-save-payment {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.btn-save-payment:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-cancel-edit-payment {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.btn-cancel-edit-payment:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-delete-payment {
    background: linear-gradient(135deg, #991b1b, #7f1d1d);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.btn-delete-payment:hover {
    background: linear-gradient(135deg, #7f1d1d, #450a0a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(153, 27, 27, 0.4);
}

.btn-delete-payment:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.success-message {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .chit-item-footer {
        flex-direction: column;
    }
    
    .payment-edit-actions {
        flex-direction: column;
    }
    
    .btn-edit-payment,
    .btn-save-payment,
    .btn-cancel-edit-payment {
        width: 100%;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

/* Recipient Checkbox Styles */
.recipient-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.recipient-item:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.recipient-item.selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

.recipient-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 1rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.recipient-info {
    flex: 1;
}

.recipient-email {
    font-weight: 600;
    color: #1f2937;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.recipient-label {
    font-size: 0.85rem;
    color: #6b7280;
}

.recipient-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.recipient-badge.customer {
    background: #dbeafe;
    color: #1e40af;
}

.recipient-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

/* Modal Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
        max-width: none;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .recipient-item {
        padding: 0.75rem;
    }
    
    .recipient-email {
        font-size: 0.9rem;
    }
}

/* ========================================
   HEADER WITH VERSION TAG
   ======================================== */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header-main {
    flex: 1;
}

/* Version Tag - In Header Banner */
.version-tag {
    display: none; /* Hidden by default, shown by JS */
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    border-radius: 50px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

.version-tag:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.version-tag .version-icon {
    font-size: 1rem;
}

.version-tag .version-text {
    letter-spacing: 0.02em;
    opacity: 0.95;
}

.version-tag .version-arrow {
    opacity: 0.7;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.version-tag:hover .version-arrow {
    opacity: 1;
    transform: translateX(3px);
}

/* Version Notification Badge */
.version-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    color: #ef4444;
    font-size: 10px;
    line-height: 12px;
    text-align: center;
    border-radius: 50%;
    animation: notificationPulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    transition: all 0.3s ease;
}

.version-notification-badge.read {
    opacity: 0;
    transform: scale(0);
}

@keyframes notificationPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 0 15px rgba(239, 68, 68, 0.8);
    }
}

.version-tag.has-notification {
    position: relative;
}

.version-tag.has-notification:hover .version-notification-badge {
    animation: none;
    transform: scale(1.3);
}

/* Login page notification badge adjustment */
.login-version-tag .version-notification-badge {
    top: -6px;
    right: -6px;
}

/* Login page specific - Fixed position version tag */
.login-version-tag {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 1000;
}

.login-version-tag:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Mobile responsive for version tag */
@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .version-tag {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
        align-self: flex-start;
    }
    
    .version-tag .version-icon {
        font-size: 0.85rem;
    }
    
    .login-version-tag {
        top: 1rem;
        left: 1rem;
    }
}

/* ========================================
   PERIOD BREAKDOWN STYLES
   ======================================== */

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 0.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Period Breakdown Container */
.period-breakdown-container {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Period Card Hover Effects */
.period-card {
    cursor: default;
    position: relative;
}

.period-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
    transition: box-shadow 0.3s ease;
    pointer-events: none;
}

.period-card:hover::after {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Period Details Button */
.btn-period-details {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-period-details:active {
    transform: translateY(1px) !important;
}

/* Period Status Colors */
.period-paid {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.period-partial {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.period-unpaid {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

/* Period Grid Responsive */
@media (max-width: 480px) {
    .period-breakdown-container > div:nth-child(4) {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)) !important;
    }
    
    .period-card {
        padding: 0.4rem !important;
    }
    
    .period-card > div:first-child {
        font-size: 0.6rem !important;
    }
    
    .period-card > div:last-child {
        font-size: 0.55rem !important;
    }
}

/* Payment Preview Styles */
.payment-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    border-radius: 12px;
    border: 2px solid #a78bfa;
}

.payment-preview h4 {
    margin: 0 0 0.75rem 0;
    color: #5b21b6;
    font-size: 0.95rem;
}

.allocation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.allocation-item:last-child {
    margin-bottom: 0;
}

.allocation-period {
    font-weight: 600;
    color: #374151;
}

.allocation-amount {
    font-weight: 700;
    color: #059669;
}

.allocation-status-change {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.allocation-status-change .arrow {
    color: #6b7280;
}

/* Print styles for period breakdown */
@media print {
    .btn-period-details {
        display: none !important;
    }
    
    .period-breakdown-container {
        display: block !important;
        page-break-inside: avoid;
    }
}

