/* 
 * PPPoE Client Management System
 * Main Stylesheet
 */

:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --danger-color: #e74c3c;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-color: #6c757d;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --footer-height: 60px;
    --border-radius: 0.25rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition-speed: 0.3s;
}

/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--body-bg);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    transition: all var(--transition-speed) ease;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-color);
    color: white;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: all var(--transition-speed) ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

/* Collapsed sidebar state for desktop */
@media (min-width: 992px) {
    body:not(.sidebar-expanded) .sidebar {
        width: var(--sidebar-collapsed-width) !important;
        overflow: visible;
    }
    
    body:not(.sidebar-expanded) .main-content {
        margin-left: var(--sidebar-collapsed-width) !important;
    }
    
    /* Expand on hover */
    body:not(.sidebar-expanded) .sidebar:hover {
        width: var(--sidebar-width) !important;
        overflow-y: auto;
    }
    
    /* Ensure active state is visible in collapsed mode */
    body:not(.sidebar-expanded) .sidebar:not(:hover) .nav-item.active .nav-link::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 4px;
        background-color: var(--primary-color);
    }
    
    /* Center icons in collapsed state */
    body:not(.sidebar-expanded) .sidebar:not(:hover) .nav-link i {
        font-size: 1.5rem;
    }
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Sidebar close button styling */
.sidebar .btn-toggle-sidebar {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1070; /* Higher than sidebar z-index */
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--transition-speed) ease;
}

@media (min-width: 992px) {
    body:not(.sidebar-expanded) .sidebar:not(:hover) .sidebar-title {
        opacity: 0;
        visibility: hidden;
    }
    
    body:not(.sidebar-expanded) .sidebar:hover .sidebar-title {
        opacity: 1;
        visibility: visible;
    }
}

.sidebar-content {
    padding: 1rem 0;
    overflow-y: auto;
    height: calc(100vh - var(--header-height));
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all var(--transition-speed) ease;
    position: relative;
    z-index: 1060; /* Higher than sidebar and overlay */
    white-space: nowrap;
}

.nav-link i {
    font-size: 1.25rem;
    min-width: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    transition: margin var(--transition-speed) ease;
}

.nav-link span {
    transition: opacity var(--transition-speed) ease;
}

@media (min-width: 992px) {
    /* Hide text when not hovering */
    body:not(.sidebar-expanded) .sidebar:not(:hover) .nav-link span {
        opacity: 0;
        visibility: hidden;
        width: 0;
    }
    
    body:not(.sidebar-expanded) .sidebar:not(:hover) .nav-link i {
        margin-right: 0;
    }
    
    body:not(.sidebar-expanded) .sidebar:not(:hover) .nav-link {
        justify-content: center;
        padding: 0.75rem 0;
    }
    
    /* Show text when hovering */
    body:not(.sidebar-expanded) .sidebar:hover .nav-link span {
        opacity: 1;
        visibility: visible;
        width: auto;
    }
    
    body:not(.sidebar-expanded) .sidebar:hover .nav-link i {
        margin-right: 0.75rem;
    }
    
    body:not(.sidebar-expanded) .sidebar:hover .nav-link {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }
}

.nav-link:hover, .nav-item.active .nav-link {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 1rem 0;
}

.nav-header {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    transition: opacity var(--transition-speed) ease;
}

.nav-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 1rem;
    transition: opacity var(--transition-speed) ease;
}

@media (min-width: 992px) {
    /* Hide headers and dividers when not hovering */
    body:not(.sidebar-expanded) .sidebar:not(:hover) .nav-header,
    body:not(.sidebar-expanded) .sidebar:not(:hover) .nav-divider {
        opacity: 0;
        visibility: hidden;
    }
    
    /* Show headers and dividers when hovering */
    body:not(.sidebar-expanded) .sidebar:hover .nav-header,
    body:not(.sidebar-expanded) .sidebar:hover .nav-divider {
        opacity: 1;
        visibility: visible;
    }
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease;
}

.top-navbar {
    height: var(--header-height);
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 990;
}

/* Desktop sidebar toggle button */
.btn-toggle-desktop {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
    border-radius: var(--border-radius);
}

.btn-toggle-desktop:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

.btn-toggle-desktop i {
    transition: transform var(--transition-speed) ease;
}

.navbar-left, .navbar-right {
    display: flex;
    align-items: center;
}

.navbar-left {
    flex: 1;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin-right: 1rem;
    display: none;
}

.page-title {
    margin: 0;
    font-weight: 600;
    color: var(--secondary-color);
}

.search-box {
    position: relative;
    width: 250px;
}

.search-box input {
    padding-right: 2.5rem;
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.search-box i {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.page-content {
    flex: 1;
    padding: 1.5rem;
    background-color: var(--body-bg);
}

.footer {
    height: var(--footer-height);
    background-color: white;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Card Styles */
.card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: none;
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem;
}

.card-title {
    margin: 0;
    font-weight: 600;
    color: var(--secondary-color);
}

.card-body {
    padding: 1.5rem;
}

/* Welcome Card */
.welcome-card {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.welcome-card .card-body {
    padding: 2rem !important;
}

.welcome-card h4 {
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
    color: white !important;
}

/* Feature Icons */
.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.5rem !important;
    color: white !important;
}

/* Quick Guide */
.quick-guide-item {
    display: flex;
    margin-bottom: 1.5rem;
}

.guide-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-right: 1rem;
    flex-shrink: 0;
}

.guide-content h6 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* Form Styles */
.form-label {
    font-weight: 500;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
}

/* Client Details */
.detail-item {
    margin-bottom: 1rem;
}

.detail-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-weight: 500;
}

/* Search Modal */
.search-container {
    max-height: 400px;
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
}

.search-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
}

.search-placeholder i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.client-result {
    padding: 0.75rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color var(--transition-speed) ease;
}

.client-result:hover {
    background-color: #f8f9fa;
}

.client-result-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.client-result-details {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Error Page */
.error-body {
    background-color: var(--body-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.error-page {
    padding: 3rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.error-title {
    font-weight: 600;
    margin-bottom: 1rem;
}

.error-message {
    color: #6c757d;
    margin-bottom: 2rem;
}

/* Responsive Styles */
@media (max-width: 991.98px) {
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        z-index: 1050; /* Higher z-index to ensure it appears above other content */
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .btn-toggle-sidebar {
        display: block;
    }
    
    /* Ensure sidebar content is always visible */
    .nav-link span,
    .sidebar-title,
    .nav-header {
        display: block !important;
    }
    
    /* Fix for body when sidebar is shown */
    body.sidebar-open {
        overflow: hidden;
    }
    
    /* Add overlay when sidebar is shown - only covers main content area */
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: var(--sidebar-width); /* Start after the sidebar */
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        pointer-events: none; /* Allow clicks to pass through the overlay */
    }
}

@media (max-width: 767.98px) {
    .page-content {
        padding: 1rem;
    }
    
    .search-box {
        width: 180px;
    }
}

@media (max-width: 575.98px) {
    .navbar-right {
        display: none;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}
