/* Dashboard Custom Styles */
body {
    background-color: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.dashboard-title {
    color: #2c3e50;
    font-weight: 600;
    margin: 0;
    font-size: 2rem;
}

/* Header layout and spacing */
.header-content {
    min-height: 60px;
}

.header-btn {
    font-size: 1rem;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-left: 1rem;
}

.header-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
    border-radius: 12px 12px 0 0 !important;
}

.card-header h5 {
    color: #495057;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Top Metrics */
.metric-item {
    padding: 0.5rem;
}

.metric-item small {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.metric-item h3 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

/* Expenses */
.expense-item {
    padding: 0.5rem 0;
}

.progress {
    height: 12px;
    border-radius: 6px;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 6px;
    transition: width 0.6s ease;
}

/* Customer Support */
.support-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.support-bar {
    border-radius: 4px;
    transition: all 0.3s ease;
}

.support-bar:hover {
    opacity: 0.8;
}

/* Critical Alerts */
.alert-item {
    padding: 0.5rem 0;
}

.alert-number {
    background-color: #6c757d;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.alert-bar {
    border-radius: 4px;
    transition: all 0.3s ease;
}

/* Sales Chart */
#salesChart {
    max-height: 300px;
}

/* Root Cause Analysis */
.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
}

/* Modal Styles */
.modal-content {
    border-radius: 12px;
    border: none;
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .metric-item h3 {
        font-size: 1.5rem;
    }
    
    .support-bar {
        width: 15px !important;
    }
    
    .btn-lg {
        padding: 0.5rem 1.5rem;
        font-size: 1rem;
    }
    
    .dashboard-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    
    .header-content > div:first-child {
        flex-direction: column;
        align-items: flex-start !important;
        width: 100%;
    }
    
    .header-btn {
        margin-left: 0;
        margin-top: 0.5rem;
        width: auto;
    }
}

@media (max-width: 576px) {
    .dashboard-title {
        font-size: 1.25rem;
        text-align: center;
        margin-bottom: 1rem;
        margin-right: 0 !important;
        width: 100%;
        display: block;
    }
    
    .header-btn {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        margin: 0 0.25rem !important;
        width: 130px;
        display: inline-block;
        text-align: center;
        white-space: nowrap;
        box-sizing: border-box;
    }
    
    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .header-content > div:first-child {
        width: 100%;
        text-align: center;
        margin-bottom: 0;
    }
    
    /* Hide desktop buttons on mobile */
    .header-content > div:first-child .header-btn,
    .header-content > .header-btn:last-child {
        display: none;
    }
    
    /* Show mobile buttons */
    .mobile-buttons {
        display: flex !important;
        justify-content: center;
        gap: 0.5rem;
        margin-top: 1rem;
        width: 100%;
    }
    
    .mobile-chat-btn,
    .mobile-alert-btn {
        margin: 0 !important;
    }
}

/* Hover Effects */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Alert Severity Colors */
.alert-danger {
    border-left: 4px solid #dc3545;
}

.alert-warning {
    border-left: 4px solid #ffc107;
}

.alert-info {
    border-left: 4px solid #0dcaf0;
}

/* Professional Color Scheme */
.text-success { color: #198754 !important; }
.text-info { color: #0dcaf0 !important; }
.text-primary { color: #0d6efd !important; }
.text-warning { color: #fd7e14 !important; }

.bg-success { background-color: #198754 !important; }
.bg-info { background-color: #0dcaf0 !important; }
.bg-primary { background-color: #0d6efd !important; }
.bg-warning { background-color: #fd7e14 !important; }
.bg-danger { background-color: #dc3545 !important; }

/* Chat Styles */
#chatWindow {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-messages {
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    max-width: 80%;
}

.chat-message.user-message {
    background-color: #0d6efd;
    color: white;
    margin-left: auto;
    margin-right: 0;
    text-align: right;
}

.chat-message.bot-message {
    background-color: white;
    border: 1px solid #e9ecef;
    margin-right: auto;
    margin-left: 0;
}

.message-content {
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-input-container {
    margin-top: 1rem;
}

#chatInput {
    border: 1px solid #ced4da;
    border-radius: 20px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

#chatInput:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

#sendChatBtn {
    border-radius: 20px;
    padding: 0.75rem 1rem;
    margin-left: -1px;
}

#chatToggleBtn {
    transition: all 0.2s ease;
}

#chatToggleBtn:hover {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

/* Chat scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Newsletter Modal Styles */
#newsletterModal .modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-height: 250px; /* Maintain consistent modal height */
}

#newsletterModal .modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
}

#newsletterModal .modal-body {
    padding: 1rem 1.5rem;
}

#newsletterModal .modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem 1.5rem 1.5rem;
}

/* Email validation states */
#newsletterEmail.is-valid {
    border-color: #198754;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

#newsletterEmail.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath d='M5.8 5.8l4.4 4.4M10.2 5.8l-4.4 4.4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

/* Shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Error highlight */
.error-highlight {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: #dc3545 !important;
    transition: all 0.3s ease;
}

/* Success state for input */
.success-highlight {
    background-color: rgba(25, 135, 84, 0.1);
    border-color: #198754 !important;
    transition: all 0.3s ease;
}
