/*
============================================================================
MAIN STYLESHEET — Non-Woven Bag Inventory & Sales System
============================================================================
This is the primary CSS file. All global/base styles live here.
Component-specific styles go into header.css, sidebar.css, footer.css, etc.

নিয়ম:
  - ❌ Inline <style> ব্যবহার করা যাবে না
  - ✅ সব CSS আলাদা .css ফাইলে রাখতে হবে
  - ✅ BEM-like naming convention (block__element--modifier)
  - ✅ Responsive design — mobile-first approach

@package    NonWovenInventory
@version    1.0.0
============================================================================
*/

/* ==========================================================================
   1. CSS VARIABLES (Custom Properties)
   ==========================================================================
   Theme colors, spacing, typography — centralized. এক জায়গায় বদলালেই
   সব জায়গায় change হবে।
*/
:root {
    /* --- Primary Colors --- */
    --color-primary:       #4f46e5;    /* Calm Indigo */
    --color-primary-dark:  #3730a3;    /* Primary dark hover */
    --color-primary-light: #818cf8;    /* Lighter primary */

    /* --- Accent Colors --- */
    --color-accent:        #0d9488;    /* Calm Teal accent */
    --color-accent-dark:   #0f766e;    /* Accent hover */
    --color-success:       #10b981;    /* Modern Success Green */
    --color-warning:       #f59e0b;    /* Modern Amber Warning */
    --color-danger:        #ef4444;    /* Modern Crimson Danger */
    --color-info:          #06b6d4;    /* Soft cyan info */

    /* --- Neutral Colors --- */
    --color-bg:            #f8fafc;    /* Calm off-white slate background */
    --color-white:         #ffffff;
    --color-text:          #1e293b;    /* Dark slate for high readability text */
    --color-text-light:    #64748b;    /* Cool gray for secondary text */
    --color-border:        #e2e8f0;    /* Soft borders */

    /* --- Typography --- */
    --font-family:         'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-base:      14px;
    --font-size-sm:        12px;
    --font-size-lg:        16px;
    --font-size-xl:        20px;
    --font-size-xxl:       24px;

    /* --- Spacing --- */
    --spacing-xs:          4px;
    --spacing-sm:          8px;
    --spacing-md:          16px;
    --spacing-lg:          24px;
    --spacing-xl:          32px;

    /* --- Layout --- */
    --sidebar-width:       260px;
    --header-height:       60px;
    --border-radius:       8px;
    --box-shadow:          0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   2. CSS RESET / BASE STYLES
   ==========================================================================
   Browser default styles reset করে consistent baseline তৈরি করা।
*/
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-accent-dark);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   3. LAYOUT — Main Container Structure
   ==========================================================================
   .main-container → flex container যা sidebar আর content-কে পাশাপাশি রাখে
*/
.main-container {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
}

/* Content area — sidebar-এর পাশে যে অংশে page content দেখায় */
.content-area {
    flex: 1;
    padding: var(--spacing-lg);
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    max-width: 100%;
}

/* ==========================================================================
   4. COMMON COMPONENT STYLES
   ==========================================================================
*/

/* --- Cards (Dashboard summary cards, form containers) --- */
.card {
    background: var(--color-white);
    border-radius: 16px !important; /* rounded-4 equivalent */
    box-shadow: var(--box-shadow) !important;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--color-border) !important;
    transition: transform 0.25s ease-in-out, box-shadow 0.25s ease-in-out !important;
}

.card.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.08), 0 6px 6px rgba(0, 0, 0, 0.04) !important;
}

.card-header {
    font-family: 'Poppins', sans-serif;
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--color-border) !important;
    background-color: transparent !important;
    color: var(--color-primary);
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 10px; /* rounded-3 equivalent */
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

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

.btn-warning {
    background-color: var(--color-warning);
    color: var(--color-white);
}
.btn-warning:hover {
    background-color: #d97706;
    color: var(--color-white);
}

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

.btn-info {
    background-color: var(--color-info);
    color: var(--color-white);
}
.btn-info:hover {
    background-color: #0891b2;
    color: var(--color-white);
}

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

.btn-outline-secondary {
    border: 1px solid var(--color-border);
    color: var(--color-text-light);
    background: transparent;
}
.btn-outline-secondary:hover {
    background: #f1f5f9;
    color: var(--color-text);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 12px;
}

.btn-shadow {
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Tables --- */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-md);
    background-color: var(--color-white);
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.table th {
    background-color: #f8fafc;
    color: var(--color-text-light);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--color-border);
}

.table tr:hover {
    background-color: #f1f5f9;
}

.table .actions {
    white-space: nowrap;
    text-align: center;
}

.table .actions .btn {
    padding: 6px 10px;
    margin: 0 2px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--color-text);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px; /* rounded-3 equivalent */
    transition: all 0.2s ease-in-out;
    background-color: var(--color-white);
    color: var(--color-text);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12); /* Calm warm glow */
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

/* --- Flash Messages & Toasts --- */
.flash-container {
    position: fixed;
    top: 76px; /* standard header-height + spacing */
    right: 24px;
    z-index: 9999;
    max-width: 400px;
    width: calc(100% - 48px);
}

.flash-message {
    animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: var(--spacing-lg);
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-light);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
}

.pagination a:hover {
    background-color: #f1f5f9;
    color: var(--color-primary);
}

.pagination .active {
    background-color: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

/* --- Status Badges --- */
.badge {
    display: inline-block;
    padding: 6px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    border-radius: 20px; /* rounded-pill */
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-success { background-color: #d1fae5; color: #065f46; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-danger  { background-color: #fee2e2; color: #991b1b; }
.badge-info    { background-color: #e0f2fe; color: #0369a1; }

/* ==========================================================================
    5. RESPONSIVE DESIGN
    ==========================================================================
*/

/* Table wrapper for responsive scroll */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--spacing-md);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
}

.table-wrapper table {
    margin-bottom: 0;
    min-width: 650px;
}

/* Search/filter bar responsive */
.filter-bar {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.filter-bar .form-control,
.filter-bar .form-select {
    max-width: 250px;
}

/* Card grid for list pages */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

/* Tablet (768px পর্যন্ত) */
@media (max-width: 768px) {
    .content-area {
        margin-left: 0;
        padding: var(--spacing-md);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table-wrapper {
        border: none;
        border-radius: 0;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .form-control,
    .filter-bar .form-select {
        max-width: 100%;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        text-align: center;
    }
}

/* Mobile (576px পর্যন্ত) */
@media (max-width: 576px) {
    .card {
        padding: var(--spacing-md);
    }

    .flash-container {
        left: var(--spacing-md);
        right: var(--spacing-md);
        max-width: none;
        top: 68px;
    }

    .content-area {
        padding: var(--spacing-sm);
    }

    .table-wrapper table {
        font-size: 13px;
    }

    .table-wrapper th,
    .table-wrapper td {
        padding: 10px 8px;
    }
}

/* ==========================================================================
   5A. ANIMATIONS & MICRO-INTERACTIONS
   ==========================================================================
*/
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Button active click shrink */
.btn:active {
    transform: scale(0.95) !important;
}

/* Smooth transitions for links, cards and lists */
a, .card, .menu-item a, .table tr {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
    5A. HERO / PUBLIC LANDING PAGE
    ==========================================================================
*/
.hero-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
    color: #fff;
}

.hero-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.hero-content h1 {
    font-size: 36px;
    margin-bottom: 15px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
}

.hero-content p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.hero-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-actions .btn-hero-primary {
    padding: 12px 30px;
    font-size: 16px;
    background: #fff;
    color: #1e293b;
    border: 2px solid #fff;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.hero-actions .btn-hero-primary:hover {
    background: transparent;
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.hero-actions .btn-hero-secondary {
    padding: 12px 30px;
    font-size: 16px;
    background: transparent;
    border: 2px solid #fff;
    color: #fff;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.hero-actions .btn-hero-secondary:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
}

/* ==========================================================================
    5B. ERROR/SUCCESS ALERT BOXES (replace inline styles)
    ==========================================================================
*/
.alert-box {
    padding: 12px 16px;
    margin-bottom: 15px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-box.alert-danger {
    background-color: var(--color-danger);
}

.alert-box.alert-success {
    background-color: var(--color-success);
}

.alert-box.alert-info {
    background-color: var(--color-info);
}

/* ==========================================================================
    5B. ICON CIRCLE (dashboard & product thumbnails)
    ==========================================================================
*/
.icon-circle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.icon-circle.icon-lg {
    width: 80px;
    height: 80px;
}

.icon-circle.icon-sm {
    width: 36px;
    height: 36px;
}

/* ==========================================================================
    5C. EMPTY STATE (no records found)
    ==========================================================================
*/
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-light);
}

.empty-state i {
    font-size: 48px;
    color: var(--color-border);
    margin-bottom: 16px;
    display: block;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 0;
}

.empty-row {
    color: var(--color-text-light);
    text-align: center;
    padding: 24px;
}

/* ==========================================================================
    5D. BACK BUTTON
    ==========================================================================
*/
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-light);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: #e2e8f0;
    color: var(--color-text);
    text-decoration: none;
}

/* ==========================================================================
    5E. SUMMARY CARD
    ==========================================================================
*/
.summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--color-white);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    box-shadow: var(--box-shadow);
    transition: all 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}

.summary-card .summary-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 20px;
    flex-shrink: 0;
}

.summary-card .summary-icon.bg-primary-light {
    background: #eef2ff;
    color: var(--color-primary);
}

.summary-card .summary-icon.bg-success-light {
    background: #d1fae5;
    color: var(--color-success);
}

.summary-card .summary-icon.bg-warning-light {
    background: #fef3c7;
    color: var(--color-warning);
}

.summary-card .summary-icon.bg-info-light {
    background: #e0f2fe;
    color: var(--color-info);
}

.summary-card .summary-icon.bg-danger-light {
    background: #fee2e2;
    color: var(--color-danger);
}

.summary-card .summary-info {
    flex: 1;
}

.summary-card .summary-info .summary-label {
    font-size: 13px;
    color: var(--color-text-light);
    margin-bottom: 4px;
}

.summary-card .summary-info .summary-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

/* ==========================================================================
    5F. PAGE HEADER (title + action buttons row)
    ==========================================================================
*/

/* ==========================================================================
    5G. PURCHASE/SALES FORM TABLE COLUMN WIDTHS
    ==========================================================================
*/
.col-product { width: 25%; }
.col-qty { width: 12%; }
.col-rate { width: 12%; }
.col-total { width: 12%; }
.col-unit { width: 14%; }
.col-sell-rate { width: 15%; }
.col-actions { width: 15%; }

.grand-total-input {
    font-weight: 700;
}

.table-total-row {
    background: #f9f9f9;
}

/* ==========================================================================
    5H. INVOICE PRINT ICON WIDTH
    ==========================================================================
*/
.icon-fixed-width {
    width: 14px;
    text-align: center;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.page-header h1,
.page-header .page-title {
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.page-header .page-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }

.d-flex    { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }

.w-100 { width: 100%; }

/* Print styles — hide non-essential elements */
@media print {
    .sidebar,
    .main-header,
    .main-footer,
    .btn,
    .no-print {
        display: none !important;
    }
    .content-area {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}
