/**
 * Common CSS for Financial Accounting System - COMPLETE WORKING VERSION
 * Location: /home/u142734668/domains/finalv2.gspkart.com/public_html/common/commoncss.css
 * Purpose: Single CSS file for entire website with dark mode support
 */

/* ===== CSS VARIABLES ===== */
:root {
    /* Light Mode Colors */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --navbar-height: 60px;
    --bottombar-height: 60px;
    
    --transition-speed: 0.3s;
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #94a3b8;
    --success-color: #22c55e;
    --danger-color: #f87171;
    --warning-color: #fbbf24;
    --info-color: #60a5fa;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    min-height: 100vh;
    padding-bottom: var(--bottombar-height);
}

/* ===== NAVBAR STYLES ===== */
.navbar {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    height: var(--navbar-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-logo {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.navbar-sitename {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.navbar-sitename:hover {
    color: var(--primary-color);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-book-selector {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    min-width: 150px;
}

.navbar-role {
    padding: 0.25rem 0.75rem;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== PROFESSIONAL USER MENU ===== */
.user-menu-container {
    position: relative;
}

.user-menu-button {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu-button:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-role-small {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

.dropdown-arrow {
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.user-menu-button[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 260px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease-in-out;
    z-index: 1001;
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1rem;
}

.dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.dropdown-user-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.dropdown-user-role {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9375rem;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.dropdown-item:hover svg {
    opacity: 1;
}

.dropdown-item-danger {
    color: var(--danger-color);
}

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.dark-mode-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.dark-mode-toggle .sun-icon {
    display: block;
    color: var(--warning-color);
}

.dark-mode-toggle .moon-icon {
    display: none;
    color: var(--info-color);
}

[data-theme="dark"] .dark-mode-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .dark-mode-toggle .moon-icon {
    display: block;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-top: var(--navbar-height);
    padding: 2rem 1rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== CARDS ===== */
.card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.5;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    opacity: 0.9;
}

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

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

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.required-mark {
    color: var(--danger-color);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color);
    color: var(--success-color);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: var(--info-color);
    color: var(--info-color);
}

/* ===== BOTTOM BAR ===== */
.bottom-bar, .bottombar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottombar-height);
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-bar-item, .bottombar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    transition: all 0.2s;
    padding: 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
}

.bottom-bar-item:hover,
.bottom-bar-item.active,
.bottombar-item:hover,
.bottombar-item.active {
    color: var(--primary-color);
}

.bottom-bar-item i,
.bottom-bar-item span,
.bottombar-item i,
.bottombar-item span {
    font-style: normal;
}

.bottom-bar-item i,
.bottombar-item i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.bottom-bar-add-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 1.75rem;
    font-weight: 300;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0.5rem;
}

.bottom-bar-add-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar {
        padding: 0 0.5rem;
    }
    
    .navbar-logo {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .navbar-sitename {
        font-size: 0.9rem;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .navbar-right {
        gap: 0.5rem;
    }
    
    .navbar-book-selector {
        display: none;
    }
    
    .navbar-role {
        display: none;
    }
    
    .user-info {
        display: none;
    }
    
    .dropdown-arrow {
        display: none;
    }
    
    .user-menu-button {
        padding: 0.375rem;
    }
    
    .user-dropdown-menu {
        min-width: 240px;
    }
    
    .main-content {
        padding: 1rem 0.75rem;
    }
    
    .card {
        padding: 0;
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }
    
    .form-control {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.justify-center { justify-content: center; }
.align-center { align-items: center; }

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }







/* ===============================================
   ADD THESE FIXES TO YOUR EXISTING commoncss.css
   Location: /home/u142734668/domains/finalv2.gspkart.com/public_html/common/commoncss.css
   =============================================== */

/* FIX 1: Navbar Container - ADD THIS NEW CLASS */
.navbar-container {
    max-width: 100%;
    width: 100%;
    height: 100%;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* FIX 2: Update existing .navbar to remove padding and justify-content */
/* FIND the existing .navbar class and REPLACE these specific lines:
   OLD: padding: 0 1rem;
   NEW: padding: 0;
   
   OLD: justify-content: space-between;
   NEW: (remove this line completely)
*/

/* FIX 3: Book selector - UPDATE existing class */
.book-selector,
.navbar-book-selector {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    min-width: 150px;
}

/* FIX 4: Mobile text overflow prevention */
p, span, div, td, th, label {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* FIX 5: Journal Entry Mobile Layout */
.journal-entry-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.journal-entry-row select.form-control,
.journal-entry-row input.form-control {
    font-size: 0.8125rem;
    padding: 0.5rem;
    min-height: 38px;
}

.journal-entry-row .remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--danger-color);
    color: white;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

/* FIX 6: Tablet/Desktop responsive for journal entry */
@media (min-width: 768px) {
    .journal-entry-row {
        grid-template-columns: 2fr 1fr 1fr 2fr auto;
        align-items: center;
    }
    
    .journal-entry-row .remove-btn {
        position: static;
        margin-left: 0.5rem;
    }
}



/* ============================================
   MOBILE TABLE FIX - Add to commoncss.css
   ============================================ */

/* Force all tables to be responsive on mobile */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Compact table on mobile */
@media (max-width: 767px) {
    .table {
        font-size: 0.75rem;
        width: 100%;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    
    /* First column sticky on mobile */
    .table th:first-child,
    .table td:first-child {
        position: sticky;
        left: 0;
        background: var(--bg-primary);
        z-index: 1;
    }
    
    /* Amount columns right-aligned and compact */
    .table td.amount,
    .table th.amount {
        text-align: right;
        padding-right: 0.5rem;
    }
}

/* Ensure numbers don't break */
.amount,
.number-cell {
    white-space: nowrap;
}

/* Card responsive */
.card {
    overflow: hidden;
    max-width: 100%;
}

.card-body {
    overflow-x: auto;
}