/* Brooks CRM Admin Styles - Material Design Inspired */
/* Color palette based on The Brooks Companies website */

:root {
    /* Brooks Companies Website Colors */
    --primary-orange: #d16711;          /* Main brand orange - buttons, links, h1 */
    --primary-blue: #668cb0;            /* Blue for h2-h6, sidebar/footer */
    --content-bg: #dee5e9;              /* Main content background */
    --text-primary: #000000;            /* Body text */
    --text-white: #ffffff;              /* White text */
    
    /* Material Design Inspired Enhancements */
    --primary-orange-light: #e8803d;    /* Lighter orange for hover states */
    --primary-orange-dark: #a8540e;     /* Darker orange for active states */
    --primary-blue-light: #7a9dc4;      /* Lighter blue for hover */
    --primary-blue-dark: #52769c;       /* Darker blue for active */
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    
    /* Sidebar Configuration */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --sidebar-bg: var(--primary-blue);
    --sidebar-text: var(--text-white);
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: rgba(255, 255, 255, 0.12);
    --sidebar-gradient-bg: linear-gradient(135deg, var(--primary-blue-light) 0%, var(--primary-blue) 100%);
    
    /* Shadows (Material Design) */
    --shadow-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-2: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    --shadow-3: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    --shadow-4: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

body {
    background-color: var(--content-bg);
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1 {
    color: var(--primary-orange);
    font-weight: 500;
    margin-bottom: 1.5rem;
}

h2, h3, h4, h5, h6 {
    color: var(--primary-blue);
    font-weight: 500;
    margin-bottom: 1rem;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.6, 1);
    z-index: 1000;
    box-shadow: var(--shadow-3);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1.5rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    min-height: 80px;
}

.sidebar-brand:hover {
    color: var(--sidebar-text);
    text-decoration: none;
    background: var(--sidebar-hover);
}

.sidebar-brand i {
    font-size: 1.75rem;
    margin-right: 1rem;
    transition: margin 0.3s ease;
    color: var(--white);
    min-width: 24px;
}

.sidebar.collapsed .sidebar-brand i {
    margin-right: 0;
}

.sidebar-brand-text {
    font-size: 1.25rem;
    font-weight: 500;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-brand-text {
    opacity: 0;
    visibility: hidden;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-radius: 0;
    position: relative;
    min-height: 48px; /* Material Design minimum touch target */
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    text-decoration: none;
}

.nav-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--white);
}

.nav-link i {
    width: 24px;
    margin-right: 1rem;
    text-align: center;
    transition: margin 0.3s ease;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.125rem;
}

.nav-link:hover i,
.nav-link.active i {
    color: var(--white);
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}

.nav-text {
    transition: opacity 0.3s ease;
    font-weight: 400;
    white-space: nowrap;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    visibility: hidden;
}

.nav-item.has-submenu > .nav-link::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free', sans-serif;
    font-weight: 900;
    margin-left: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

.sidebar.collapsed .nav-item.has-submenu > .nav-link::after {
    opacity: 0;
}

.nav-item.has-submenu.open > .nav-link::after {
    transform: rotate(180deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.1);
}

.submenu.show {
    max-height: 400px;
}

.submenu .nav-link {
    padding-left: 3.5rem;
    font-size: 0.875rem;
    min-height: 40px;
}

.submenu .nav-link i {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
}

.submenu .nav-link:hover i,
.submenu .nav-link.active i {
    color: rgba(255, 255, 255, 0.9);
}

.sidebar.collapsed .submenu {
    display: none;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.6, 1);
    background: var(--content-bg);
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Bar */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-1);
    min-height: 64px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--gray-600);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: var(--gray-100);
    color: var(--primary-blue);
}

.content-wrapper {
    padding: 1.5rem;
}

/* Cards and Components */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-1);
    border-radius: var(--radius-md);
    transition: box-shadow 0.2s ease;
}

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

.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 1rem 1.5rem;
}

.card-header h5,
.card-header h6 {
    color: var(--primary-blue);
    margin-bottom: 0;
    font-weight: 500;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn-primary {
    background: var(--primary-orange);
    border-color: var(--primary-orange);
    color: var(--text-white);
    font-weight: 500;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-primary:hover {
    background: var(--primary-orange-light);
    border-color: var(--primary-orange-light);
    color: var(--text-white);
    box-shadow: var(--shadow-2);
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--primary-orange-dark);
    border-color: var(--primary-orange-dark);
    box-shadow: var(--shadow-1);
    transform: translateY(0);
}

.btn-outline-primary {
    color: var(--primary-orange);
    border-color: var(--primary-orange);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0.75rem 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-outline-primary:hover {
    background-color: var(--primary-orange);
    border-color: var(--primary-orange);
    color: var(--text-white);
    box-shadow: var(--shadow-1);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Button Icon Alignment */
.btn i {
    line-height: 1;
    vertical-align: baseline;
}

.btn i + * {
    margin-left: 0.5rem;
}

.btn * + i {
    margin-left: 0.5rem;
}

/* Ensure consistent button heights */
.btn {
    min-height: 2.5rem; /* 40px minimum touch target */
}

.btn-sm {
    min-height: 2rem; /* 32px for small buttons */
}

/* Dashboard Cards */
.border-left-primary {
    border-left: 4px solid var(--primary-orange);
}

.border-left-success {
    border-left: 4px solid #4caf50;
}

.border-left-info {
    border-left: 4px solid #2196f3;
}

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

/* Text Utilities */
.text-xs {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.font-weight-bold {
    font-weight: 600;
}

.text-gray-800 {
    color: var(--gray-800);
}

.text-gray-300 {
    color: var(--gray-400);
}

.text-primary {
    color: var(--primary-orange);
}

/* Links */
a {
    color: var(--primary-orange);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-orange-dark);
    text-decoration: underline;
}

/* Form Enhancements */
.form-control {
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(209, 103, 17, 0.1);
    outline: none;
}

/* Table Enhancements */
.table {
    background: var(--white);
}

.table thead th {
    background-color: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    color: var(--gray-700);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

/* Alert Enhancements */
.alert {
    border-radius: var(--radius-md);
    border: none;
    box-shadow: var(--shadow-1);
}

.alert-primary {
    background-color: rgba(209, 103, 17, 0.1);
    color: var(--primary-orange-dark);
    border-left: 4px solid var(--primary-orange);
}

/* Dropdown Enhancements */
.dropdown-menu {
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-2);
    border-radius: var(--radius-md);
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--gray-50);
    color: var(--text-primary);
}

/* Badge Enhancements */
.badge {
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.75rem;
}

.badge.bg-primary {
    background-color: var(--primary-orange);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    
    .sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-4);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .topbar {
        padding: 1rem;
    }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}