/* KPI Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

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

.stat-card {
    display: flex;
    justify-content: space-between;
}

.stat-info .stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-info .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.icon-primary { background: var(--primary-light); color: var(--primary); }
.icon-success { background: rgba(5, 150, 105, 0.1); color: var(--success); }
.icon-warning { background: rgba(217, 119, 6, 0.1); color: var(--warning); }
.icon-info { background: rgba(37, 99, 235, 0.1); color: var(--info); }

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

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

.btn-outline:hover {
    background-color: var(--bg-main);
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

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

.btn-danger:hover {
    background-color: #b91c1c;
}


/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(5, 150, 105, 0.1); color: var(--success); }
.badge-warning { background: rgba(217, 119, 6, 0.1); color: var(--warning); }
.badge-danger { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.badge-info { background: rgba(37, 99, 235, 0.1); color: var(--info); }

/* Progress Bars */
.progress-wrapper {
    margin-top: 0.5rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
}

/* Form Controls */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--primary-light);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Chat UI (WhatsApp/Telegram Style) */
.chat-window {
    display: flex;
    flex-direction: column;
    height: 500px;
    background: #e5ddd5; /* Classic WhatsApp Background */
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png'); /* Subtle doodle pattern */
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-date-separator {
    align-self: center;
    background: rgba(225, 245, 254, 0.9);
    color: #546e7a;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    margin: 1rem 0;
    text-transform: uppercase;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.chat-bubble-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 4px;
}

.chat-bubble-wrapper.sent {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.chat-bubble {
    max-width: 75%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    line-height: 1.4;
    word-break: break-word;
}

.chat-bubble.sent {
    background: #e00072; /* Vitthal Group Red */
    color: white;
    border-top-right-radius: 0;
}

.chat-bubble.received {
    background: white;
    color: var(--text-main);
    border-top-left-radius: 0;
}

.chat-bubble.sent .chat-meta,
.chat-bubble.sent .chat-status {
    color: rgba(255, 255, 255, 0.8);
}

.chat-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 2px;
    font-size: 0.65rem;
    opacity: 0.6;
}

.chat-status {
    color: #34b7f1; /* WhatsApp Blue Checks */
}

.chat-input-area {
    padding: 0.75rem 1rem;
    background: #f0f2f5;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chat-input-wrapper {
    flex: 1;
    background: white;
    border-radius: 25px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
}

.chat-input-wrapper textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    max-height: 100px;
    font-size: 0.9rem;
    padding: 2px 0;
}

.chat-btn-icon {
    color: #919191;
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
}

.chat-btn-icon:hover {
    color: var(--primary);
}

/* Enterprise Quotation System */
.line-item-editor {
    background: var(--bg-main);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.line-item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 40px;
    gap: 10px;
    align-items: center;
    margin-bottom: 0.75rem;
}

.quote-preview {
    background: white;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    font-family: 'Inter', sans-serif;
}

.quote-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.quote-table {
    width: 100%;
    margin: 2rem 0;
}

.quote-table th {
    background: var(--bg-main);
    color: var(--text-main);
    padding: 0.75rem;
    font-weight: 700;
}

.quote-total-section {
    float: right;
    width: 250px;
    margin-top: 1rem;
}

.quote-total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.quote-total-row.final {
    border-bottom: none;
    color: var(--primary);
    font-weight: 800;
    font-size: 1.25rem;
}

.quote-terms {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
}
