/* ===========================================
   SecureBiz - Main Stylesheet
   =========================================== */

/* ----- CSS Variables ----- */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --danger-gradient: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --sidebar-bg: linear-gradient(180deg, #1a1c2e 0%, #2d3154 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --dark-bg: #1a1c2e;
    --text-light: rgba(255,255,255,0.9);
    --text-muted-light: rgba(255,255,255,0.7);
    --text-faded: rgba(255,255,255,0.4);
    --shadow-primary: 0 4px 15px rgba(102, 126, 234, 0.4);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --border-radius: 10px;
    --border-radius-lg: 12px;
    --transition-speed: 0.3s;
}

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

/* ----- Modern Navbar ----- */
.navbar-modern {
    background: #ffffff;
    border-bottom: 1px solid #e8ecf3;
    padding: 0.6rem 0;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.navbar-modern .navbar-toggler {
    color: #4a5568;
    padding: 0.5rem;
}

/* Brand */
.navbar-modern .brand-icon {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.navbar-modern .brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.5px;
}

.navbar-modern .brand-highlight {
    color: var(--primary-color);
}

/* Nav Links */
.navbar-modern .nav-link {
    color: #4a5568;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.navbar-modern .nav-link:hover {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.08);
}

/* Navbar Breadcrumb */
.navbar-breadcrumb .breadcrumb {
    font-size: 0.875rem;
    background: none;
    padding: 0;
}
.navbar-breadcrumb .breadcrumb-item a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s;
}
.navbar-breadcrumb .breadcrumb-item a:hover {
    color: var(--primary-color);
}
.navbar-breadcrumb .breadcrumb-item.active {
    color: #1f2937;
    font-weight: 500;
}
.navbar-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: #d1d5db;
}

/* Search Box */
.navbar-modern .search-box {
    position: relative;
}

.navbar-modern .search-box input {
    background: #f7f8fc;
    border: 1px solid #e8ecf3;
    border-radius: 10px;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    font-size: 0.875rem;
    width: 200px;
    transition: all 0.2s ease;
}

.navbar-modern .search-box input:focus {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    width: 250px;
}

.navbar-modern .search-box .search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 0.8rem;
}

/* Search Results Dropdown */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e8ecf3;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
    min-width: 320px;
}

.search-results-dropdown.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
}

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

.search-result-item:hover {
    background-color: #f7f8fc;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 500;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 0.75rem;
    margin-top: 0.125rem;
}

.search-no-results {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #6c757d;
    font-size: 0.875rem;
}

/* Icon Buttons */
.navbar-modern .nav-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #64748b;
    transition: all 0.2s ease;
}

.navbar-modern .nav-icon-btn:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

.navbar-modern .notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Divider */
.navbar-modern .nav-divider {
    width: 1px;
    height: 24px;
    background: #e2e8f0;
    margin: 0 0.5rem;
}

/* User Dropdown */
.navbar-modern .user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0.5rem 0.375rem 0.375rem !important;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.navbar-modern .user-dropdown:hover {
    background: #f7f8fc;
}

.navbar-modern .user-avatar-modern {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
}

.navbar-modern .status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border: 2px solid white;
    border-radius: 50%;
}

.navbar-modern .user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.navbar-modern .user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1a202c;
}

.navbar-modern .user-role {
    font-size: 0.75rem;
    color: #94a3b8;
}

.navbar-modern .dropdown-arrow {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-left: 0.25rem;
    transition: transform 0.2s ease;
}

.navbar-modern .user-dropdown[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* Modern Dropdown */
.dropdown-modern {
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    padding: 0.5rem;
    min-width: 240px;
    margin-top: 0.5rem;
}

.dropdown-modern .dropdown-header-modern {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 12px;
    background: #f8fafc;
    margin-bottom: 0.25rem;
}

.dropdown-modern .dropdown-user-avatar {
    width: 44px;
    height: 44px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.dropdown-modern .dropdown-user-info {
    display: flex;
    flex-direction: column;
}

.dropdown-modern .dropdown-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a202c;
}

.dropdown-modern .dropdown-user-email {
    font-size: 0.8rem;
    color: #64748b;
}

.dropdown-modern .dropdown-divider {
    margin: 0.25rem 0;
    border-color: #f1f5f9;
}

.dropdown-modern .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    transition: all 0.15s ease;
}

.dropdown-modern .dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    color: #94a3b8;
}

.dropdown-modern .dropdown-item:hover {
    background: #f8fafc;
    color: var(--primary-color);
}

.dropdown-modern .dropdown-item:hover i {
    color: var(--primary-color);
}

.dropdown-modern .dropdown-item-danger {
    color: #ef4444;
}

.dropdown-modern .dropdown-item-danger i {
    color: #ef4444;
}

.dropdown-modern .dropdown-item-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* Legacy support */
.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--secondary-gradient);
    border: 2px solid rgba(255,255,255,0.3);
    font-weight: 600;
    font-size: 14px;
    transition: transform var(--transition-speed) ease;
}

.user-avatar:hover {
    transform: scale(1.05);
}

/* ----- Dropdown Styles ----- */
.dropdown-menu {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.dropdown-item {
    padding: 10px 20px;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--primary-gradient);
    color: #fff;
}

.dropdown-item:hover i {
    color: #fff !important;
}

.dropdown-item.text-danger:hover {
    background: var(--danger-gradient);
}

/* ----- Sidebar Styles ----- */
.sidebar {
    background: #1e293b;
    min-height: calc(100vh - 56px);
}

.sidebar .nav-link {
    color: #94a3b8;
    padding: 12px 20px;
    margin: 4px 12px;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
    font-weight: 500;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: #334155;
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    color: #fff;
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
}

.sidebar-header {
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 20px 20px 10px;
}

.see-all-link {
    font-size: 11px;
    font-weight: 500;
    color: var(--primary-color);
    text-decoration: none;
    text-transform: none;
    letter-spacing: 0;
}

.see-all-link:hover {
    color: #8b9cf6;
    text-decoration: underline;
}

.sidebar-footer {
    background: #0f172a;
    border-radius: var(--border-radius-lg);
    margin: 12px;
    padding: 15px;
}

/* Create Ad Set Button */
.btn-create-adset {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.btn-create-adset:hover {
    background: #5a6fd6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Ad Sets List */
.ad-sets-list {
    max-height: 300px;
    overflow-y: auto;
}

.ad-sets-list .nav-link .badge {
    background: #475569 !important;
    font-weight: 500;
    font-size: 11px;
}

/* ----- Modal Styles ----- */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 1.5rem 1.5rem 0.5rem;
}

.modal-title {
    font-weight: 600;
    color: #1a202c;
}

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

.modal-footer {
    padding: 0.5rem 1.5rem 1.5rem;
}

.modal-footer .btn {
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
}

.modal-footer .btn-light {
    background: #f1f5f9;
    border: none;
    color: #475569;
}

.modal-footer .btn-light:hover {
    background: #e2e8f0;
}

/* ----- Sidebar Toggle Button ----- */
.sidebar-toggle-btn {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 1040;
    background: var(--primary-color);
    border: none;
    color: white;
    width: 24px;
    height: 48px;
    padding: 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 0 12px rgba(102, 126, 234, 0.3);
    transition: all var(--transition-speed) ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    background: #5a6fd6;
    color: white;
    width: 32px;
}

.sidebar-toggle-btn i {
    font-size: 0.75rem;
}

/* ----- Offcanvas Sidebar ----- */
.offcanvas.sidebar-offcanvas {
    background: #1e293b;
}

.offcanvas.sidebar-offcanvas .offcanvas-header {
    border-bottom: 1px solid #334155;
}

.offcanvas.sidebar-offcanvas .offcanvas-title {
    color: #fff;
}

.offcanvas.sidebar-offcanvas .btn-close {
    filter: invert(1);
}

.offcanvas.sidebar-offcanvas .nav-link {
    color: #94a3b8;
    padding: 12px 20px;
    margin: 4px 12px;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
    font-weight: 500;
}

.offcanvas.sidebar-offcanvas .nav-link:hover {
    color: #fff;
    background: #334155;
}

.offcanvas.sidebar-offcanvas .nav-link.active {
    color: #fff;
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ----- Badge Styles ----- */
.badge-pro {
    background: #ec4899;
    font-size: 10px;
    padding: 4px 8px;
}

/* ----- Card Styles ----- */
.card {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-weight: 600;
}

/* ----- Button Styles ----- */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
    box-shadow: var(--shadow-primary);
    transition: all var(--transition-speed) ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-gradient {
    background: var(--primary-gradient);
    border: none;
    color: white;
    box-shadow: var(--shadow-primary);
    transition: all var(--transition-speed) ease;
}

.btn-gradient:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: white;
    transform: translateY(-2px);
}

/* ----- Form Styles ----- */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* ----- Table Styles ----- */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

/* ----- Utility Classes ----- */
.bg-gradient-primary {
    background: var(--primary-gradient);
}

.bg-gradient-secondary {
    background: var(--secondary-gradient);
}

.bg-gradient-danger {
    background: var(--danger-gradient);
}

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ----- Animations ----- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ----- Scrollbar Styles ----- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ----- Responsive Adjustments ----- */
@media (max-width: 991.98px) {
    .main-content {
        padding-left: 15px;
        padding-right: 15px;
    }
}

@media (max-width: 767.98px) {
    .card {
        margin-bottom: 1rem;
    }
}
