/* =========================================================
   Jewellery Shop Manager - Shared Stylesheet
   Ye ek hi file poore app ki styling handle karti hai.
   Pehle har page ke andar apna alag <style> block tha,
   ab sab pages isi file ko link karte hain.
   ========================================================= */

:root {
    --brand-primary: #0d47a1;      /* deep blue - header/sidebar accent */
    --brand-primary-dark: #093170;
    --brand-accent: #c9a227;       /* gold accent - jewellery theme */
    --brand-accent-dark: #a4831b;
    --brand-success: #28a745;
    --brand-success-dark: #218838;
    --brand-danger: #dc3545;
    --brand-warning: #ffc107;
    --surface: #ffffff;
    --surface-muted: #f5f7fa;
    --border-color: #e5e7eb;
    --text-main: #2b2f36;
    --text-muted: #6b7280;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-soft: 0 6px 20px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 8px 25px rgba(0, 0, 0, 0.08);
}

/* ---------- Base ---------- */
html, body {
    height: 100%;
}

body {
    background: var(--surface-muted);
    color: var(--text-main);
    font-family: "Segoe UI", "Poppins", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--brand-primary); }
a:hover, a:focus { color: var(--brand-primary-dark); }

label { font-weight: 500; color: #444; }

/* ---------- App Shell / Sidebar ---------- */
.sidebar {
    width: 250px;
    background: var(--surface);
    border-right: 1px solid var(--border-color);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transition: width 0.3s, left 0.3s;
    overflow-x: hidden;
    z-index: 1050;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.sidebar.collapsed { width: 70px; }

.menu-list { list-style: none; padding: 10px; margin: 0; }
.menu-item { margin-bottom: 5px; }

.menu-item > a,
.menu-item > div {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    text-decoration: none;
    color: #374151;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: background 0.3s, color 0.3s;
}

.menu-item > a:hover,
.menu-item > div:hover {
    background: #f0f7ff;
    color: var(--brand-primary);
}

.menu-item.active > a {
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(13, 71, 161, 0.35);
}

.menu-icon { font-size: 18px; min-width: 24px; margin-right: 12px; color: inherit; }
.menu-text { flex: 1; white-space: nowrap; transition: 0.3s; }
.sidebar.collapsed .menu-text { opacity: 0; transform: translateX(-10px); pointer-events: none; }

.menu-arrow { margin-left: auto; transition: transform 0.3s; font-size: 12px; }
.menu-item.open > .menu-arrow { transform: rotate(90deg); }

.submenu-list {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-left: 15px;
    border-left: 2px solid var(--border-color);
    transition: max-height 0.5s, opacity 0.3s;
    padding-left: 10px;
}

.menu-item.open > .submenu-list { max-height: 500px; opacity: 1; margin-top: 5px; }
.submenu-item { padding: 6px 0; }

.submenu-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #4b5563;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.3s, color 0.3s;
}
.submenu-link:hover { background: #eff6ff; color: var(--brand-primary); }

.red-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--brand-danger);
    border-radius: 50%;
    margin-left: 6px;
    box-shadow: 0 0 6px var(--brand-danger);
}

#toggleSidebar { display: none; }
@media (min-width: 769px) {
    #toggleSidebar { display: inline-block; }
    #mobileToggle { display: none; }
}

@media (max-width: 768px) {
    .sidebar { left: -250px; transition: left 0.3s ease-in-out; }
    .sidebar.show { left: 0; }
    body.sidebar-open::before {
        content: "";
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1040;
    }
    .main-content { margin-left: 0 !important; }
}

/* ---------- Main content / page shell ---------- */
.main-content {
    margin-left: 250px;
    padding: 20px;
    transition: margin-left 0.3s;
}
.sidebar.collapsed ~ .main-content { margin-left: 70px; }

/* ---------- Cards ---------- */
.card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: #fff;
    font-size: 1.35rem;
    font-weight: 500;
    padding: 18px;
    text-align: center;
}

h3.title {
    text-align: center;
    color: var(--brand-primary);
    font-weight: 600;
    margin-bottom: 25px;
}

.section-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--brand-primary);
    margin-bottom: 12px;
    border-left: 4px solid var(--brand-primary);
    padding-left: 8px;
}

.total-box {
    background: #f5faff;
    border-radius: var(--radius-md);
    padding: 15px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
}

/* ---------- Tables ---------- */
table { border-radius: var(--radius-md); overflow: hidden; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
thead { background: #343a40; color: #fff; }
tbody tr:hover { background-color: #f1f1f1; transition: 0.2s; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius-sm); }

.btn-primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    font-weight: 500;
    transition: 0.2s ease-in-out;
}
.btn-primary:hover {
    background: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    transform: translateY(-1px);
}

.btn-success,
.btn-add { background-color: var(--brand-success); border-color: var(--brand-success); color: #fff; }
.btn-success:hover,
.btn-add:hover { background-color: var(--brand-success-dark); border-color: var(--brand-success-dark); }

.btn-danger,
.btn-remove { background-color: var(--brand-danger); border-color: var(--brand-danger); color: #fff; }
.btn-danger:hover,
.btn-remove:hover { background-color: #c62828; border-color: #c62828; }

.btn-warning { background: var(--brand-warning); border: none; color: #000; }

.btn-custom { background: var(--brand-primary); color: #fff; font-weight: bold; }
.btn-custom:hover { background: var(--brand-primary-dark); color: #fff; }

.btn-sm { border-radius: var(--radius-sm); font-size: 0.85rem; padding: 5px 10px; }

.form-control, .form-select {
    border-radius: var(--radius-md);
    border: 1px solid #ccc;
}

/* ---------- Login page ---------- */
body.login-page {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: url('../images/imagesne.jpg') no-repeat center center fixed;
    background-size: cover;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: rgba(255, 255, 255, 0.93);
    border-radius: var(--radius-lg);
    padding: 35px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.logo { text-align: center; margin-bottom: 20px; }
.logo img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--brand-accent);
    padding: 5px;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    object-fit: cover;
}

/* ---------- Dashboard cards ---------- */
.card-icon { font-size: 40px; margin-bottom: 10px; color: var(--brand-primary); }
a.card-link { text-decoration: none; color: inherit; }
.card:hover { transform: translateY(-5px); transition: transform 0.2s ease-in-out; }

/* ---------- Add / Edit form pages ---------- */
.form-label { font-weight: 500; }
span.required { color: var(--brand-danger); margin-left: 2px; }
.content-wrapper { margin-left: 250px; padding: 20px; }
@media (max-width: 991px) { .content-wrapper { margin-left: 0; } }

/* ---------- Gold loan add/edit item rows ---------- */
.item-box { background: #fafafa; border: 1px solid var(--border-color); padding: 15px; border-radius: var(--radius-md); margin-bottom: 15px; }
.add-btn { background: var(--brand-success); color: #fff; border: none; border-radius: var(--radius-sm); padding: 8px 18px; }
.remove-btn { background: var(--brand-danger); color: #fff; border: none; border-radius: var(--radius-sm); padding: 6px 14px; }
.btn-submit { background: var(--brand-primary); color: #fff; width: 100%; padding: 12px; font-size: 17px; border-radius: var(--radius-md); border: none; }
.btn-submit:hover { background: var(--brand-primary-dark); }

/* ---------- View / detail pages ---------- */
.label { font-weight: 600; color: #333; }
.value { background: #f9fafc; border: 1px solid var(--border-color); padding: 8px 12px; border-radius: var(--radius-sm); min-height: 36px; }

@media (min-width: 992px) {
    .content { margin-left: 240px; transition: margin-left 0.3s; }
    .sidebar.collapsed ~ .content { margin-left: 70px; }
}

/* select2 widget (bill page) */
.select2-container--default .select2-selection--single {
    border-radius: var(--radius-sm);
    padding: 6px;
    height: 45px;
    font-size: 1rem;
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 768px) {
    .btn-sm-responsive { font-size: 0.7rem !important; padding: 3px 6px !important; border-radius: 4px !important; }
    .btn-add-responsive { font-size: 0.8rem !important; padding: 6px 10px !important; }
    .main-content { padding: 12px; }
    .card-header { font-size: 1.1rem; padding: 14px; }
}
