﻿/* ================================
   Google Font
================================ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* ================================
   Base Color Palette
================================ */
:root {
    --jet-black: #2f323a;
    --dusty-lavender: #77567a;
    --orchid-mist: #c47ac0;
    --pink-mist: #e39ec1;
    --cotton-rose: #debac0;

}

/* ================================
   Theme Variables
================================ */
:root {
    --app-primary: #77567a;
    --app-primary-dark: #684a6b;
    --app-primary-darker: #5a3f5d;
    --app-primary-rgb: 119, 86, 122;
    --app-accent: #c47ac0;
    --app-accent-soft: #f4e8f3;
    --app-bg: #f8f9fa;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --text-primary: #2f323a;
    --text-muted: #6b6f7a;
    --primary-gradient: linear-gradient(135deg, #77567a 0%, #c47ac0 100%);
    --input-height-sm: 36px;
    --input-height-lg: 48px;
    --input-border-radius: 6px;
    --input-padding-x: 12px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 24px;
}

/* ================================
   Base
================================ */
body {
    font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f0f2f5;
}

/* ================================
   Bootstrap Form-Floating Fix
================================ */
.form-floating>.form-control,
.form-floating>.form-select {
    padding: 10px var(--input-padding-x) !important;
    height: 42px !important;
    min-height: 42px !important;
    line-height: 1.25 !important;
}

.form-floating>label {
    padding: 0 5px !important;
    left: 11px !important;
    background-color: white !important;
    height: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex;
    align-items: center;
    transition: top 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), font-size 0.25s ease, opacity 0.25s ease;
}

.form-floating>.form-control:focus~label,
.form-floating>.form-control:not(:placeholder-shown)~label,
.form-floating>.form-select~label {
    top: 0 !important;
    transform: translateY(-50%) !important;
    font-size: 0.75rem !important;
    opacity: 1 !important;
}

/* Ensure select text is visible and not covered by label */
.form-floating>.form-select {
    padding-top: 10px !important;
}



/* Buttons */
.btn {
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--app-primary-dark) 0%, var(--app-primary-darker) 100%);
}

/* Card Neomorphism */
.stat-card {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 5px 5px 15px #d1d9e6, -5px -5px 15px #ffffff;
    transition: all 0.3s ease;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(45deg, #212529, #495057);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Responsive Tables */
@media (max-width: 768px) {
    .table-responsive-stack tbody tr {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 0.75rem;
        background-color: #fbfbfc !important;
        border: 1px solid #f0f0f0;
        border-radius: 12px;
        padding: 12px;
    }

    .table-responsive-stack td.col-name {
        width: 100%;
        order: 1;
    }
}

/* Header & Containers */
.header-bg {
    background: var(--primary-gradient);
    backdrop-filter: blur(10px);
    color: white;
    padding: 2.5rem 0;
    border-radius: 0 0 32px 32px;
    box-shadow: 0 10px 30px rgba(var(--app-primary-rgb), 0.15);
    position: relative;
    z-index: 10;
}

.card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--card-shadow);
    background: white;
}

.logo-circular {
    width: 100px;
    height: 100px;
    border-radius: 50% !important;
    object-fit: cover;
    border: 2px solid var(--app-primary);
    padding: 5px;
    background: white;
}

/* ================================
   Main Container
================================ */
.main-container {
    max-width: 1200px;
   /* margin-top: -40px !important;*/
    position: relative;
    padding-bottom: 100px;
}

.invoice-summary-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-top: 20px;
}

.summary-total {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--app-primary);
}

/* ================================
   Tables
================================ */
@media (min-width: 769px) {
    .table td {
        vertical-align: middle;
    }

    .col-sno {
        width: 40px;
        text-align: center;
    }

    .col-name {
        width: 54%;
    }

    .col-hsn,
    .col-uom,
    .col-gst {
        display: none;
    }

    .col-qty {
        width: 10%;
        text-align: right;
    }

    .col-rate {
        width: 12%;
        text-align: right;
    }

    .col-amt {
        width: 15%;
        text-align: right;
    }

    .col-action {
        width: 50px;
    }

    .nav-tabs {
        border-bottom: 2px solid #dee2e6;
        margin-bottom: 1.5rem;
    }

    .nav-tabs .nav-link {
        border: none;
        color: #6c757d;
        font-weight: 500;
        padding: 12px 20px;
        transition: all 0.2s;
    }

    .nav-tabs .nav-link:hover {
        color: var(--app-primary);
        border: none;
    }

    .nav-tabs .nav-link.active {
        color: var(--app-primary);
        background: transparent;
        border-bottom: 3px solid var(--app-primary) !important;
    }

    .col-qty input,
    .col-rate input,
    .col-gst input {
        text-align: right;
    }

    .table input.form-control-sm {
        margin: 0;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 80px;
    }

    .menu-avatar {
        width: 65px;
        height: 65px;
        border-radius: 50%;
        border: 2px solid rgba(255, 255, 255, 0.8);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
        margin-bottom: 1rem;
        object-fit: cover;
        background: white;
    }

    .app-info-footer {
        padding: 1.5rem;
        background: #f8f9fa;
        border-top: 1px solid #eee;
        font-size: 0.75rem;
        color: #6c757d;
    }

    .nav-tabs {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        z-index: 1050;
        display: flex;
        justify-content: space-around;
        margin-bottom: 0 !important;
        padding: 8px 0;
        border: none;
        border-top: 1px solid #eee;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    }

    .nav-tabs .nav-item {
        margin-bottom: 0;
    }

    .nav-tabs .nav-link {
        border: none;
        flex-direction: column;
        align-items: center;
        display: flex;
        font-size: 0.7rem;
        padding: 0;
        color: #adb5bd;
    }

    .nav-tabs .nav-link i {
        font-size: 1.25rem;
        margin-bottom: 4px;
        margin-right: 0 !important;
    }

    .nav-tabs .nav-link.active {
        color: var(--app-primary);
        background: transparent;
        border-bottom: none;
    }

    .table-responsive-stack thead {
        display: none;
    }

    .table-responsive-stack tbody tr {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 0.75rem;
        background-color: #fbfbfc !important;
        border: 1px solid #f0f0f0;
        border-radius: 12px;
        padding: 12px;
        position: relative;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }

    .table-responsive-stack td {
        display: block;
        border: none;
        padding: 2px;
    }

    .table-responsive-stack td.col-sno {
        display: none !important;
    }

    .table-responsive-stack td.col-name {
        width: 100%;
        order: 1;
        margin-top: 0;
        margin-bottom: 6px;
        padding-left: 2px;
        padding-right: 35px;
    }

    .table-responsive-stack td.col-qty,
    .table-responsive-stack td.col-rate,
    .table-responsive-stack td.col-amt {
        flex: 1 1 30%;
        min-width: 80px;
        order: 2;
        padding: 8px 4px;
        display: block !important;
    }

    .table-responsive-stack td.col-qty::before {
        content: "Qty";
    }

    .table-responsive-stack td.col-rate::before {
        content: "Rate";
    }

    .table-responsive-stack td.col-amt::before {
        content: "Amount";
    }

    .table-responsive-stack td.col-qty::before,
    .table-responsive-stack td.col-rate::before,
    .table-responsive-stack td.col-amt::before {
        display: block !important;
        width: 100% !important;
        font-size: 0.65rem !important;
        font-weight: 700;
        text-transform: uppercase;
        margin-bottom: 3px;
        color: #94a3b8;
        text-align: center;
    }

    .table-responsive-stack td.col-hsn,
    .table-responsive-stack td.col-uom,
    .table-responsive-stack td.col-gst {
        display: none !important;
    }

    .table-responsive-stack td.col-action {
        position: absolute;
        top: 8px;
        right: 8px;
        width: auto !important;
        background: transparent !important;
        padding: 0 !important;
        order: 5;
    }

    .table-responsive-stack td.col-action .icon-action {
        width: 28px !important;
        height: 28px !important;
        box-shadow: none !important;
        background: rgba(220, 53, 69, 0.05) !important;
    }

    .table-responsive-stack td::before {
        display: none;
    }

    .table-responsive-stack .form-control {
        padding: 10px 5px;
        font-size: 1.1rem;
        height: 48px !important;
        text-align: center;
        border-radius: 10px;
        background: #ffffff;
        width: 100% !important;
        border: 1px solid #cbd5e1;
    }

    .table-responsive-stack .form-control:focus {
        border-color: var(--app-primary);
        background: #ffffff;
        box-shadow: 0 0 0 3px rgba(var(--app-primary-rgb), 0.1);
    }

    .table-responsive-stack .line-total {
        background: #f8fafc !important;
        color: var(--app-primary);
        font-weight: 800;
    }

    .add-item-btn {
        position: fixed;
        bottom: 85px;
        right: 20px;
        z-index: 1060;
        width: 60px;
        height: 60px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        background: var(--primary-gradient);
        color: white;
        border: none;
        box-shadow: 0 4px 15px rgba(var(--app-primary-rgb), 0.4);
        transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    }

    .add-item-btn:active {
        transform: scale(0.95);
        box-shadow: 0 2px 8px rgba(var(--app-primary-rgb), 0.3);
    }
}

/* General UI Polish */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    background: var(--glass-bg);
}

.header-bg {
    background: linear-gradient(135deg, rgba(var(--app-primary-rgb), 0.9) 0%, rgba(191, 205, 207, 0.9) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    color: white;
    padding: 2rem 0;
    /*margin-bottom: 2rem;*/
    border-radius: 0 0 24px 24px;
    position: relative;
    z-index: 10;
}

/* Icon Action Style */
.icon-action {
    cursor: pointer !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: all 0.2s;
    font-size: 1.1rem;
    width: 38px;
    height: 38px;
    border-radius: 8px;
}

.icon-action:hover {
    transform: scale(1.1);
    background-color: rgba(var(--app-primary-rgb), 0.1);
}

.icon-action.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

/* Login Overlay - Refined Card Design */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e9ecef;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s;
}

.login-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
    padding: 3rem 2.5rem;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.login-input {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 1rem;
    transition: all 0.3s;
    color: #495057;
}

.login-input:focus {
    background: #fff;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 4px rgba(var(--app-primary-rgb), 0.1);
}

.login-btn {
    border-radius: 12px;
    padding: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(var(--app-primary-rgb), 0.2);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--app-primary-rgb), 0.3);
    background: linear-gradient(135deg, var(--app-primary-dark) 0%, var(--app-primary-darker) 100%);
    color: white;
}

/* Toast Styles */
.toast {
    background: white;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.toast-header {
    border-bottom: 1px solid #f0f0f0;
    background: white;
    font-weight: 600;
}

.toast-body {
    font-size: 0.95rem;
    padding: 16px;
}

/* Dashboard & Reports */
.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--card-shadow);
    height: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 4px;
    display: block;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

@media (max-width: 768px) {
    .stat-value {
        font-size: 1.4rem;
    }

    .stat-card {
        padding: 16px;
        border-radius: 16px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
}

/* ================================
   Checkbox & Radio Inputs
================================ */
.checkbox-custom {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    margin-bottom: var(--spacing-sm);
}

.checkbox-custom input[type="checkbox"],
.checkbox-custom input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--app-primary);
}

/* ================================
   Form Sections
================================ */
.form-section {
    margin-bottom: var(--spacing-xl);
}

.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid #dee2e6;
}

/* ================================
   Utility Classes
================================ */
.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.p-sm {
    padding: var(--spacing-sm);
}

.p-md {
    padding: var(--spacing-md);
}

.p-lg {
    padding: var(--spacing-lg);
}

/* ================================
   Floating Label – Textarea Fix
================================ */
.form-floating>textarea.form-control {
    height: auto !important;
    min-height: 90px;
    /* adjust as needed */
    padding: 16px 12px 8px !important;
    line-height: 1.4;
    resize: vertical;
}


/* ================================
   Extra-Compact Floating Inputs
================================ */
.form-floating>input.form-control,
.form-floating>select.form-select {
    height: 42px !important;
    min-height: 42px !important;
    padding: 10px 12px !important;
    font-size: 0.95rem;
}

.form-floating>select.form-select {
    padding-right: 30px !important;
}

/* ================================
   PWA Install Prompt
================================ */
.install-prompt {
    position: fixed;
    bottom: 85px;
    left: 20px;
    right: 20px;
    background: white;
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 2050;
    display: none;
    align-items: center;
    justify-content: space-between;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.install-prompt img {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    margin-right: 15px;
}

.install-prompt-content {
    flex-grow: 1;
}

.install-prompt-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.install-prompt-text {
    font-size: 0.8rem;
    color: #6c757d;
}

.install-buttons {
    display: flex;
    gap: 10px;
}

@media (min-width: 769px) {
    .install-prompt {
        bottom: 20px;
        left: auto;
        right: 20px;
        width: 350px;
    }
}

/* ================================
   Offcanvas Side Menu Improvements
   ================================ */
.offcanvas {
    border: none !important;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1) !important;
}

.offcanvas-start {
    width: 300px !important;
}

.offcanvas-header {
    background: #fff;
    padding: 1.5rem;
}

.offcanvas-body {
    background: #fff;
}

.menu-profile {
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 15px rgba(var(--app-primary-rgb), 0.1);
}

.list-group-item-action {
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--text-muted);
}

.list-group-item-action:hover {
    background-color: rgba(var(--app-primary-rgb), 0.05);
    color: var(--app-primary);
    transform: translateX(5px);
}

.list-group-item-action.active {
    background: var(--primary-gradient) !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(var(--app-primary-rgb), 0.3);
}

.offcanvas-footer {
    font-size: 0.8rem;
    color: #adb5bd;
}