/* ============================================
   KALPTARU-INSPIRED MODERN STYLING
   BSBG - Bhoi Samaj Bachat Gat
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6f8;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 70px;
}

/* ============================================
   NAVBAR STYLES
   ============================================ */
.navbar {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar ul {
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.navbar li {
    position: relative;
}

.navbar a {
    color: white;
    text-decoration: none;
    padding: 16px 18px;
    display: block;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.navbar a:hover,
.navbar a.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: inset 0 -3px 0 rgba(255,255,255,0.3);
}

.menu-left {
    flex: 1 1 auto;
    display: flex;
    min-width: 0;
}

.menu-right {
    flex: 0 0 auto;
    display: flex !important;
    margin-left: auto;
}

.menu-left,
.menu-right {
    align-items: center;
}

/* Navbar header (brand + hamburger toggle) — hidden on desktop */
.navbar-header {
    display: none;
}

.navbar-brand {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0 5px;
    letter-spacing: 0.5px;
}

.navbar-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.35);
    color: white;
    padding: 7px 13px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: background 0.2s;
}

.navbar-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.navbar-collapse {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.dropdown {
    position: relative;
}

.dropbtn {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #2c3e50;
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1100;
    border-radius: 4px;
    top: 100%;
    right: 0;
    margin-top: 2px;
}

.dropdown-content.show {
    display: block;
}

.dropdown-content a {
    color: white;
    padding: 12px 18px;
    text-decoration: none;
    display: block;
    transition: 0.2s;
    font-weight: 400;
}

.dropdown-content a:hover {
    background: #3498db;
    padding-left: 22px;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */
.container {
    width: min(1100px, 95%);
    margin: 30px auto 100px;
    padding: 0 15px;
}

.page-title {
    margin: 25px auto 10px;
    width: min(1100px, 95%);
    padding: 0 15px;
}

.page-title h1 {
    margin: 0;
    font-size: 2rem;
    color: #222;
    font-weight: 700;
}

.page-description {
    color: #666;
    font-size: 0.95rem;
    margin: 8px 0 0;
}

/* ============================================
   HEADER & ACTIONS
   ============================================ */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    gap: 15px;
    flex-wrap: wrap;
}

.summary-actions {
    width: min(1100px, 95%);
    margin: 0 auto 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    gap: 15px;
    flex-wrap: wrap;
}

.summary-actions p {
    margin: 0;
    color: #666;
}

/* ============================================
   BUTTONS
   ============================================ */
.add-btn,
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #3498db;
    color: white;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.add-btn:hover,
.btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.add-btn.success { background-color: #27ae60; }
.add-btn.success:hover { background-color: #229954; }

.add-btn.danger { background-color: #e74c3c; }
.add-btn.danger:hover { background-color: #c0392b; }

.add-btn.warning { background-color: #f39c12; }
.add-btn.warning:hover { background-color: #d68910; }

.add-btn.manage-btn { background-color: #16a085; }
.add-btn.manage-btn:hover { background-color: #138d75; }

/* ============================================
   FORMS
   ============================================ */
.form-card {
    max-width: 560px;
    margin: 30px auto 100px;
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 18px;
    border-left: 4px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 18px;
    border-left: 4px solid #c3e6cb;
}

/* ============================================
   TABLES
   ============================================ */
#itable {
    border-collapse: collapse;
    width: 100%;
    margin: auto;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: hidden;
}

.bsbg-table-scroll {
    width: 100%;
}

.bsbg-table-scroll > table {
    width: 100%;
}

#itable thead {
    background-color: #2c3e50;
    color: white;
}

#itable th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 2px solid #34495e;
}

#itable td {
    padding: 12px 16px;
    border-bottom: 1px solid #ecf0f1;
    font-size: 0.95rem;
}

#itable.accounts-table th {
    padding: 14px 10px;
}

#itable.accounts-table td {
    padding: 12px 10px;
}

#itable tbody tr:hover {
    background: #f8f9fa;
    transition: 0.2s;
}

.action-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.action-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    text-decoration: none;
    color: white;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.action-links a.edit {
    background-color: #3498db;
}
.action-links a.edit:hover {
    background-color: #2980b9;
}

.action-links a.delete {
    background-color: #e74c3c;
}
.action-links a.delete:hover {
    background-color: #c0392b;
}

.action-links a.view {
    background-color: #27ae60;
}
.action-links a.view:hover {
    background-color: #229954;
}

.action-links a.manage {
    background-color: #16a085;
}
.action-links a.manage:hover {
    background-color: #138d75;
}

.empty-state {
    width: 95%;
    margin: 40px auto;
    text-align: center;
    color: #555;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.empty-state i {
    font-size: 3rem;
    color: #bdc3c7;
    display: block;
    margin-bottom: 10px;
}

/* ============================================
   DASHBOARD - SUMMARY CARDS
   ============================================ */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: 30px auto;
    width: min(1100px, 95%);
    padding: 0 15px;
}

.home-page .container,
.home-page .page-title,
.dashboard-page .page-title,
.dashboard-page .summary-grid,
.about-page .container,
.about-page .page-title {
    width: min(1320px, 98%);
    padding-left: 8px;
    padding-right: 8px;
}

.summary-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 24px;
    min-height: 160px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.summary-card .icon {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2.5rem;
    color: rgba(52, 152, 219, 0.15);
}

.summary-card h2 {
    margin: 0 0 12px;
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card .value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin: 8px 0;
}

.summary-card .subtext {
    font-size: 0.85rem;
    color: #888;
    margin: 0;
}

/* ============================================
   LINKS
   ============================================ */
.back-link {
    display: inline-block;
    margin-top: 16px;
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s;
}

.back-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

a {
    color: #3498db;
    text-decoration: none;
    transition: 0.2s;
}

a:hover {
    color: #2980b9;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    text-align: center;
    padding: 15px;
    background-color: #2c3e50;
    color: white;
    position: fixed;
    bottom: 0;
    width: 100%;
    font-size: 0.9rem;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

/* ============================================
   SEARCH & FILTERS
   ============================================ */
.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ============================================
   DETAIL BOXES
   ============================================ */
.detail-box {
    flex: 1;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.detail-title {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .navbar a {
        padding: 14px 12px;
        font-size: 0.88rem;
    }

    .home-page .container,
    .home-page .page-title,
    .dashboard-page .page-title,
    .dashboard-page .summary-grid,
    .about-page .container,
    .about-page .page-title {
        width: min(1100px, 95%);
    }

    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    /* ---- Hamburger menu ---- */
    .navbar {
        flex-direction: column;
        align-items: stretch;
    }

    .navbar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 15px;
    }

    .navbar-toggle {
        display: block;
    }

    .navbar-collapse {
        display: none;
        flex-direction: column;
        align-items: stretch;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .navbar-collapse.open {
        display: flex;
    }

    .navbar ul {
        flex-direction: column;
        flex-wrap: nowrap;
        width: 100%;
    }

    .menu-left {
        flex: none;
    }

    .menu-right {
        width: 100%;
        margin-left: 0 !important;
        border-top: 1px solid rgba(255,255,255,0.08);
    }

    .navbar a {
        padding: 12px 16px;
        font-size: 0.9rem;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    /* Dropdown on mobile: click-based, not hover */
    .dropdown:hover .dropdown-content {
        display: none;
    }

    .dropdown-content {
        position: static;
        box-shadow: none;
        background-color: #1a2530;
        border-radius: 0;
        min-width: 100%;
        margin-top: 0;
        width: 100%;
    }

    .dropdown-content.show {
        display: block !important;
    }

    /* ---- Layout ---- */
    .container,
    .page-title,
    .summary-actions {
        width: 100% !important;
        padding: 0 10px;
    }

    .page-title h1 {
        font-size: 1.5rem;
    }

    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }

    .summary-card {
        padding: 16px;
        min-height: 140px;
    }

    .summary-card .value {
        font-size: 1.5rem;
    }

    /* ---- Responsive tables ---- */
    .bsbg-table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .bsbg-table-scroll > table,
    .bsbg-table-scroll > #itable {
        width: max-content !important;
        min-width: 720px;
        margin: 0;
    }

    #itable th, #itable td {
        padding: 10px 8px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .action-links {
        flex-wrap: nowrap;
    }

    .action-links a {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .header-actions,
    .summary-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .add-btn {
        width: 100%;
        justify-content: center;
    }

    .form-card {
        margin: 20px 15px 100px;
        padding: 24px;
    }

    .footer {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .navbar a {
        padding: 10px 10px;
        font-size: 0.85rem;
    }

    .page-title h1 {
        font-size: 1.2rem;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .bsbg-table-scroll > table,
    .bsbg-table-scroll > #itable {
        min-width: 640px;
    }

    #itable {
        font-size: 0.8rem;
    }

    #itable th, #itable td {
        padding: 8px;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.text-muted { color: #888; }
.font-bold { font-weight: 700; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }

.details-shell {
    width: min(1100px, 95%);
    margin: 0 auto 32px;
}

.details-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 24px;
}

.details-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
    padding: 24px;
}

.details-card h2,
.details-card h3 {
    margin-top: 0;
    margin-bottom: 18px;
    color: #2c3e50;
}

.details-list {
    display: grid;
    gap: 14px;
}

.details-item {
    padding-bottom: 12px;
    border-bottom: 1px solid #ecf0f1;
}

.details-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.details-item span {
    display: block;
    font-size: 0.82rem;
    color: #7f8c8d;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.details-item strong {
    color: #2c3e50;
    font-size: 1rem;
}

.details-balance {
    font-size: 2rem;
    font-weight: 700;
    color: #27ae60;
    margin: 0;
}

.details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.transactions-table-wrapper {
    overflow-x: auto;
}

.upload-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #ecf0f1;
}

.upload-section h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.upload-help {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.document-item-card {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.documents-list {
    display: grid;
    gap: 12px;
}

.document-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid #ecf0f1;
    border-radius: 10px;
    background: #f8fbfd;
}

.document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.documents-empty {
    color: #7f8c8d;
    margin: 0;
}

@media (max-width: 900px) {
    .details-grid {
        grid-template-columns: 1fr;
    }

    .document-row {
        flex-direction: column;
        align-items: flex-start;
    }
}
