/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Login Page Styles */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 40px;
    text-align: center;
}

.login-header {
    margin-bottom: 30px;
}

.login-header i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 10px;
}

.login-header h1 {
    color: #333;
    margin-bottom: 5px;
}

.login-header p {
    color: #666;
    font-size: 0.9rem;
}

.login-form {
    text-align: left;
}

.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 2px solid #e1e1e1;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group i {
    position: absolute;
    right: 12px;
    top: 38px;
    color: #999;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    margin-bottom: 20px;
}

.login-btn:hover {
    transform: translateY(-2px);
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #fcc;
    margin-top: 10px;
}

.success-message {
    background: #efe;
    color: #3c3;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #cfc;
    margin-top: 10px;
}

.auth-links {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

.demo-info {
    margin-top: 15px;
    color: #666;
    font-style: italic;
}

.demo-credentials {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
    font-size: 0.9rem;
}

.demo-credentials p {
    margin-bottom: 5px;
}

/* Dashboard Layout */
.dashboard-page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #34495e;
}

.sidebar-header i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #3498db;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.nav-menu {
    list-style: none;
    flex: 1;
    padding: 20px 0;
}

.nav-menu li {
    margin-bottom: 5px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: #34495e;
    color: white;
    border-right: 3px solid #3498db;
}

.nav-menu a i {
    margin-right: 10px;
    width: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #34495e;
}

.logout-btn {
    width: 100%;
    padding: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #c0392b;
}

.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 20px;
    background: #f8f9fa;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.page-header h1 {
    color: #2c3e50;
    font-size: 2rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
}

.user-info i {
    font-size: 1.5rem;
    color: #3498db;
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.warning {
    border-left: 4px solid #f39c12;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3498db;
    color: white;
    font-size: 1.5rem;
}

.stat-card.warning .stat-icon {
    background: #f39c12;
}

.stat-info h3 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 5px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-feature-settings: "kern" 1;
    text-rendering: optimizeLegibility;
    font-weight: 600;
}

.stat-info p {
    color: #666;
    font-size: 0.9rem;
}

/* Ensure rupee symbol displays correctly */
.stat-info h3::before {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Specific styling for rupee symbol in total sales */
#totalSales {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif !important;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Charts */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chart-container.large {
    grid-column: 1 / -1;
}

.chart-container h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

/* Chart Canvas Optimization */
.chart-container canvas {
    max-width: 100% !important;
    height: 300px !important;
    display: block;
}

#salesChart {
    width: 100% !important;
    height: 300px !important;
}

#stockChart {
    width: 100% !important;
    height: 300px !important;
}

/* Prevent chart container overflow */
.chart-container {
    position: relative;
    overflow: hidden;
    min-height: 350px;
}

/* Smooth transitions for chart interactions */
.chart-container:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}

/* Recent Activities */
.recent-activities {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.activity-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.activity-section h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-info h4 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.activity-info p {
    color: #666;
    font-size: 0.9rem;
}

.activity-status {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.activity-status.low-stock {
    background: #fee;
    color: #c33;
}

.activity-status.normal {
    background: #efe;
    color: #3c3;
}

/* Buttons */
.primary-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.primary-btn:hover {
    background: #2980b9;
}

.secondary-btn {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.secondary-btn:hover {
    background: #7f8c8d;
}

.danger-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.danger-btn:hover {
    background: #c0392b;
}

/* Tables */
.products-container,
.sales-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.products-filters,
.sales-filters,
.forecast-filters {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.products-filters input,
.products-filters select,
.sales-filters input,
.sales-filters select,
.forecast-filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.products-table-container,
.sales-table-container,
.table-container {
    overflow-x: auto;
}

.products-table,
.sales-table,
.forecast-table,
.report-table {
    width: 100%;
    border-collapse: collapse;
}

.products-table th,
.products-table td,
.sales-table th,
.sales-table td,
.forecast-table th,
.forecast-table td,
.report-table th,
.report-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.products-table th,
.sales-table th,
.forecast-table th,
.report-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.products-table tbody tr:hover,
.sales-table tbody tr:hover,
.forecast-table tbody tr:hover,
.report-table tbody tr:hover {
    background: #f8f9fa;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.low-stock {
    background: #fee;
    color: #c33;
}

.status-badge.normal-stock {
    background: #efe;
    color: #3c3;
}

.status-badge.high-stock {
    background: #eef;
    color: #33c;
}

.action-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-right: 5px;
    transition: opacity 0.3s;
}

.action-btn:hover {
    opacity: 0.8;
}

.action-btn.edit {
    background: #f39c12;
    color: white;
}

.action-btn.delete {
    background: #e74c3c;
    color: white;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.modal-content.small {
    max-width: 400px;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #2c3e50;
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.modal-form {
    padding: 20px;
}

.modal-body {
    padding: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.modal-actions {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Sales Summary */
.sales-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.summary-card h3 {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 1.8rem;
    font-weight: 600;
    color: #2c3e50;
}

.summary-value.warning {
    color: #f39c12;
}

.summary-value.danger {
    color: #e74c3c;
}

/* Forecast Styles */
.forecast-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.forecast-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.forecast-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.forecast-charts {
    margin-bottom: 30px;
}

.forecast-tables {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.table-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.table-section h3 {
    padding: 20px;
    margin: 0;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    color: #2c3e50;
}

.priority-high {
    color: #e74c3c;
    font-weight: 600;
}

.priority-medium {
    color: #f39c12;
    font-weight: 600;
}

.priority-low {
    color: #27ae60;
    font-weight: 600;
}

/* Reports Styles */
.report-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.report-controls input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.report-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.report-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.report-tables {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-page {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .recent-activities {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .products-filters,
    .sales-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .products-filters input,
    .products-filters select,
    .sales-filters input,
    .sales-filters select {
        width: 100%;
    }
    
    .forecast-controls,
    .report-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .report-actions {
        flex-direction: column;
    }
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none;
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9999;
    transform: translateX(450px) scale(0.8);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 420px;
    min-width: 320px;
    border-left: 5px solid #3498db;
    opacity: 0;
    visibility: hidden;
}

.notification.show {
    transform: translateX(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.notification.success {
    border-left-color: #27ae60;
    background: linear-gradient(135deg, #ffffff 0%, #f0fff4 100%);
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.notification.success i {
    color: #ffffff;
    background: #27ae60;
    padding: 8px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.notification.error {
    border-left-color: #e74c3c;
    background: linear-gradient(135deg, #ffffff 0%, #fff8f8 100%);
}

.notification.error i {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    padding: 8px;
    border-radius: 50%;
}

.notification.warning {
    border-left-color: #f39c12;
    background: linear-gradient(135deg, #ffffff 0%, #fffcf8 100%);
}

.notification.warning i {
    color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
    padding: 8px;
    border-radius: 50%;
}

.notification.info {
    border-left-color: #3498db;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.notification i {
    font-size: 20px;
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
    padding: 8px;
    border-radius: 50%;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification span {
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
    line-height: 1.4;
}

.notification.success span {
    color: #1e7e34;
    font-weight: 700;
}

/* Notification animation keyframes */
@keyframes popupSlideIn {
    0% {
        transform: translateX(450px) scale(0.3) rotate(10deg);
        opacity: 0;
    }
    50% {
        transform: translateX(-20px) scale(1.05) rotate(-2deg);
        opacity: 0.8;
    }
    70% {
        transform: translateX(10px) scale(0.95) rotate(1deg);
        opacity: 0.9;
    }
    100% {
        transform: translateX(0) scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes popupSlideOut {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    30% {
        transform: translateX(-10px) scale(1.02);
        opacity: 0.8;
    }
    100% {
        transform: translateX(450px) scale(0.8);
        opacity: 0;
    }
}

.notification.popup-in {
    animation: popupSlideIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.notification.popup-out {
    animation: popupSlideOut 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53);
}
