/* SaaS Platform - Main Stylesheet */
/* Bootstrap 5.3 Integration - Custom styles to complement Bootstrap */

/* CSS Variables for Consistency */
/* These variables will work alongside Bootstrap's CSS custom properties */
:root {
    /* Override Bootstrap's primary colors to match our brand */
    --bs-primary: #3b82f6;
    --bs-primary-rgb: 59, 130, 246;
    --bs-secondary: #64748b;
    --bs-secondary-rgb: 100, 116, 139;
    --bs-success: #10b981;
    --bs-success-rgb: 16, 185, 129;
    --bs-warning: #f59e0b;
    --bs-warning-rgb: 245, 158, 11;
    --bs-danger: #ef4444;
    --bs-danger-rgb: 239, 68, 68;
    
    /* Our custom variables (keeping for legacy compatibility) */
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --border-radius: 0.5rem;
    --box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Bootstrap Integration - Override base styles */
body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
}

/* Ensure our custom styles work with Bootstrap */
.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger, .text-error { color: var(--error-color) !important; }

/* Custom btn classes to complement Bootstrap */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

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

/* Custom Layout Components (complement Bootstrap containers) */
/* Keep our custom containers for specific use cases */
.container-custom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-sm-custom {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Override Bootstrap container for our specific styling */
.container, .container-sm {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (max-width: 576px) {
    .container, .container-sm {
        padding: 0 0.75rem;
    }
}

/* Custom card styles to enhance Bootstrap cards */
.card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--surface-color);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: var(--background-color);
    border-top: 1px solid var(--border-color);
}

/* Enhanced card hover effects */
.card:hover {
    box-shadow: var(--box-shadow-lg);
    transition: box-shadow 0.15s ease-in-out;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

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

.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-error { color: var(--error-color); }

/* Enhanced Form Elements to work with Bootstrap */
.form-group {
    margin-bottom: 1rem;
}

/* Custom form styles that complement Bootstrap */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Override Bootstrap form-control with our styling */
.form-control {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control.is-invalid,
.form-control.error {
    border-color: var(--error-color);
}

.invalid-feedback,
.form-error {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.form-text,
.form-help {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Enhanced Button Styles to complement Bootstrap */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    line-height: 1.5;
    border: 1px solid transparent;
}

/* Override Bootstrap button colors with our brand colors */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

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

.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: #475569;
    border-color: #475569;
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.btn-danger {
    background-color: var(--error-color);
    border-color: var(--error-color);
    color: white;
}

/* Custom outline button that works with Bootstrap */
.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover, .btn-outline:focus {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Ensure our block button works with Bootstrap */
.btn-block {
    width: 100%;
    display: block;
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Enhanced Alerts to complement Bootstrap alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

/* Custom alert colors that work with Bootstrap */
.alert-success {
    background-color: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.alert-danger,
.alert-error {
    background-color: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-info,
.alert-primary {
    background-color: #dbeafe;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* Alert dismissible styles */
.alert-dismissible {
    padding-right: 3rem;
}

.alert .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 1.25rem 1rem;
}

/* Enhanced Navigation to work with Bootstrap navbar */
.navbar {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.navbar-brand:hover, .navbar-brand:focus {
    color: var(--primary-dark);
    text-decoration: none;
}

.navbar-nav .nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
    color: var(--primary-color);
}

.navbar-nav .nav-link.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Custom navbar styles */
.navbar-light .navbar-toggler {
    border-color: var(--border-color);
}

.navbar-light .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2859, 130, 246, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Custom Utilities (Bootstrap provides most of these, but keeping for legacy) */
/* These will work alongside Bootstrap utilities */
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* Custom spacing utilities for specific needs */
.p-custom { padding: 1.25rem; }
.m-custom { margin: 1.25rem; }

/* Custom display utilities */
.d-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.d-flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Enhanced Responsive Design to work with Bootstrap breakpoints */
@media (max-width: 576px) {
    .container, .container-sm {
        padding: 0 0.75rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Bootstrap Enhancement - Mobile Navbar Toggle */
.mobile-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1050;
    background: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    padding: 0.5rem;
    box-shadow: var(--box-shadow);
}

/* Enhanced Feature Grid for Bootstrap */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card {
    transition: transform 0.2s ease-in-out;
}

.feature-card:hover {
    transform: translateY(-2px);
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    background: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

/* Alert enhancements for Bootstrap compatibility */
.alert {
    border-radius: var(--border-radius);
    border: 1px solid transparent;
}

/* Form validation styles */
.was-validated .form-control:valid,
.form-control.is-valid {
    border-color: var(--success-color);
}

.was-validated .form-control:invalid,
.form-control.is-invalid {
    border-color: var(--error-color);
}

/* Loading States */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Homepage Specific Styles */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: white; /* Ensure white text on gradient background */
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Dashboard header fixes - improved contrast */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
}

.dashboard-header h1,
.dashboard-header h2,
.dashboard-header h3 {
    color: white !important;
    margin-bottom: 0.5rem;
}

.dashboard-header p,
.dashboard-header .text-muted {
    color: rgba(255, 255, 255, 0.85) !important;
}

.dashboard-header .small,
.dashboard-header small {
    color: rgba(255, 255, 255, 0.75) !important;
}

.features {
    padding: 4rem 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card {
    text-align: center;
    padding: 2rem;
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    background: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}