/* Base styles */
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    min-height: 100vh;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

/* Sidebar Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

.sidebar {
    width: 250px;
    background: #2d3a4a;
    color: white;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.sidebar.collapsed {
    transform: translateX(-200px);
    width: 50px;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #3a4a5c;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    overflow: hidden;
}

.logo-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.sidebar-logo {
    max-width: 120px;
    margin-bottom: 10px;
}

.sidebar.collapsed .sidebar-logo {
    max-width: 30px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: white;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar-nav {
    padding: 20px 0;
    background: inherit; /* Inherit from parent sidebar */
    color: inherit;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.nav-item {
    margin: 5px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #b8c5d1;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.nav-link:hover {
    background: #3a4a5c;
    color: white;
}

.nav-link.active {
    background: #ff4b00;
    color: white;
}

.nav-icon {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .nav-link {
    padding: 12px 15px;
    justify-content: center;
}

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

/* Network-level sidebar styles */
.nav-section-title {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid #3a4a5c;
    margin-bottom: 10px;
    background: rgba(255, 75, 0, 0.1);
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.nav-section-title .nav-icon {
    font-size: 1.5rem;
    margin-right: 12px;
    vertical-align: middle;
    width: 20px;
    text-align: center;
}

.nav-section-title .nav-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.nav-slug {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 2px;
}

.nav-divider {
    height: 1px;
    background-color: #3a4a5c;
    margin: 12px 0;
}

.nav-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-link.disabled:hover {
    background: transparent;
    color: #b8c5d1;
}

.sidebar.collapsed .nav-section-title {
    padding: 10px 15px;
    justify-content: center;
}

.sidebar.collapsed .nav-section-title .nav-content {
    display: none;
}

.sidebar.collapsed .nav-section-title .nav-icon {
    margin-right: 0;
}

.sidebar-toggle {
    position: fixed;
    top: 15px;
    left: 260px;
    background: #2d3a4a;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    z-index: 1001;
    transition: left 0.3s ease;
    font-size: 16px;
}

.sidebar.collapsed + .sidebar-toggle {
    left: 60px;
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
    transition: margin-left 0.3s ease;
    min-width: 0;
    overflow-x: hidden;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 50px;
}

.top-bar {
    background: white;
    padding: 10px 20px 10px 60px;
    margin: -20px -20px 20px -20px;
    border-bottom: 1px solid #e3e6ea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header {
    margin: 0;
    color: #2d3a4a;
    font-size: 24px;
    font-weight: 700;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    background: none;
    border: 1px solid #ff4b00;
    color: #ff4b00;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #ff4b00;
    color: white;
}

/* Search Box */
.search-box {
    margin: 10px 20px 20px 20px;
    position: relative;
    border-top: 1px solid #3a4a5c;
    padding-top: 15px;
    box-sizing: border-box;
    overflow: hidden;
}

.search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #3a4a5c;
    border-radius: 5px;
    background: #3a4a5c;
    color: white;
    font-size: 14px;
    box-sizing: border-box;
    max-width: 100%;
}

.search-input::placeholder {
    color: #b8c5d1;
}

.sidebar.collapsed .search-box {
    display: none;
}

/* Search Results Dropdown */
.search-results {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 10000;
    display: none;
    box-sizing: border-box;
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
    color: #333;
}

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

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

.search-result-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.search-result-details {
    font-size: 12px;
    color: #666;
}

.search-no-results,
.search-error {
    padding: 12px 15px;
    color: #666;
    font-style: italic;
    text-align: center;
}

.search-error {
    color: #ff6b6b;
}

/* Header and Logo */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    max-width: 120px;
    margin-bottom: 10px;
}

.login-logo {
    display: block;
    margin: 48px auto 16px auto;
    max-width: 160px;
    border-radius: 0px;
    box-shadow: 0 2px 8px rgba(44,62,80,0.07);
    border: 0px solid #000;
}

/* Containers */
.dashboard-container, .main-container {
    max-width: 100%;
    width: 100%;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.login-container {
    max-width: 400px;
    margin: 50px auto;
    background: #fff;
    padding: 36px 32px 32px 32px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(44, 62, 80, 0.10);
    border: 1px solid #e3e6ea;
}

.status-container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(44, 62, 80, 0.10);
    border: 1px solid #e3e6ea;
}

/* Login page layout */
.login-page {
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Page titles */
.page-title {
    text-align: center;
    margin-bottom: 30px;
    color: #2d3a4a;
    font-weight: 700;
    font-size: 24px;
    letter-spacing: 0.5px;
}

h1, h2 {
    text-align: center;
    margin-bottom: 32px;
    color: #2d3a4a;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e1e8ed;
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #2d3a4a;
}

tr:hover {
    background-color: #f8fafc;
}

/* Sortable table styles */
.sortable-table {
    width: 100%;
    border-collapse: collapse;
}

.sortable-table th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-align: left;
}

.sortable-table th.sortable {
    transition: background-color 0.2s ease;
}

.sortable-table th.sortable:hover {
    background-color: #e9ecef;
}

/* Forms */
.login-form, .form {
    display: flex;
    flex-direction: column;
}

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

label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    color: #2d3a4a;
}

input[type="text"], input[type="password"], input[type="email"], select, textarea {
    width: 100%;
    padding: 11px;
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 15px;
    background: #f7fafc;
    color: #2d3a4a;
    transition: border-color 0.2s;
}

input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus, select:focus, textarea:focus {
    border-color: #2563eb;
    outline: none;
    background: #fff;
}

/* Login form specific styles */
.login-form .login-btn {
    background-color: #ff4b00;
    color: #fff;
    padding: 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 2px 8px rgba(255,75,0,0.15);
}

.login-form .login-btn:hover {
    background-color: #d63b00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,75,0,0.25);
}

/* Form buttons should be full width */
.form .btn, .login-form .btn, form .btn {
    width: 100%;
}

/* Form action buttons (Cancel/Save) should not be full width */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-start;
}

.btn-form-action {
    width: auto !important;
    min-width: 120px;
    padding: 10px 20px;
    font-size: 14px;
}

/* Buttons */
button, .btn {
    background-color: #ff4b00;
    color: #fff;
    padding: 13px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255,75,0,0.08);
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

button:hover, .btn:hover {
    background-color: #d63b00;
}

.btn-secondary {
    background-color: #2563eb;
}

.btn-secondary:hover {
    background-color: #1746a2;
}

.btn-primary {
    background-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-outline {
    background-color: transparent;
    color: #6c757d;
    border: 2px solid #6c757d;
    padding: 11px 18px; /* Adjust for border width */
    box-sizing: border-box;
}

.btn-outline:hover {
    background-color: #6c757d;
    color: white;
}

.btn-danger {
    background-color: #e74c3c;
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
    display: inline-block;
}

/* Card specific button styles */
.card .btn, .card .btn-small {
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
}

/* Error messages */
.error {
    color: #fff;
    margin-bottom: 18px;
    padding: 12px;
    background-color: #e74c3c;
    border: 1px solid #e74c3c;
    border-radius: 5px;
    font-weight: 500;
    box-shadow: 0 1px 4px rgba(231,76,60,0.07);
}

/* Logout link */
.logout-link {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #ff4b00;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border: 1px solid #ff4b00;
    border-radius: 5px;
    transition: all 0.2s;
}

.logout-link:hover {
    background-color: #ff4b00;
    color: #fff;
}

/* Navigation */
nav a {
    margin: 0 15px;
    color: #2d3a4a;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.2s;
}

nav a:hover {
    background-color: #f0f0f0;
}

/* Status indicators */
.status-online {
    color: #2ecc71;
    font-weight: 600;
}

.status-offline {
    color: #e74c3c;
    font-weight: 600;
}

/* Grid layouts */
.grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.card {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
    border: 1px solid #e3e6ea;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.12);
}

.card h3 {
    margin-top: 0;
    color: #2d3a4a;
}

/* Action buttons */
.actions {
    text-align: right;
    margin: 20px 0;
}

.actions .btn {
    margin-left: 10px;
}

/* Content container */
.content-container {
    max-width: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
    overflow-x: hidden;
}

/* Page header actions */
.page-header-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

/* Card styling */
.card-header {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #e3e6ea;
    margin-bottom: 20px;
}

.card-header h3 {
    margin: 0 0 20px 0;
    color: #2d3a4a;
    font-weight: 600;
}

.card-body {
    padding: 0 20px 20px 20px;
}

/* Table styling */
.table-responsive {
    overflow-x: auto;
    max-width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    min-width: 600px;
}

.table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #2d3a4a;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #e3e6ea;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #e3e6ea;
    color: #2d3a4a;
}

.table tr:hover {
    background-color: #f8fafc;
}

/* Badge styling */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: #2ecc71;
    color: white;
}

.badge-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
    margin-right: 5px;
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid #ff4b00;
    color: #ff4b00;
}

.btn-outline-primary:hover {
    background: #ff4b00;
    color: white;
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid #e74c3c;
    color: #e74c3c;
}

.btn-outline-danger:hover {
    background: #e74c3c;
    color: white;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 16px;
}

/* Text truncation for sidebar elements */
.nav-text, .sidebar-title, .nav-content span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-section-title .nav-content a {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Guest Network Navigation Styles */
.nav-section-title .gateway-name {
    margin-top: 2px;
}

.nav-section-title .gateway-link {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-section-title .gateway-link:hover {
    color: #ffffff;
}

.nav-section-title .guest-network-name {
    margin-top: 2px;
    font-size: 0.85rem;
    color: #ffffff;
    font-weight: 600;
}

.nav-section-subtitle {
    padding: 8px 20px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    border-bottom: 1px solid #3a4a5c;
    margin-bottom: 8px;
}

.nav-divider {
    height: 1px;
    background-color: #3a4a5c;
    margin: 12px 0;
}

/* Ensure sidebar-nav has consistent positioning and background */
.sidebar-nav {
    padding: 20px 0;
    background: #2d3a4a; /* Explicitly set to match sidebar */
    color: #ffffff;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Network content styles */
.nav-content {
    display: inline-block;
    vertical-align: middle;
}

.network-link {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9rem;
}

.network-link:hover {
    color: #ffffff;
}

.network-link span {
    font-weight: 600;
}

.nav-slug {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 2px;
}

/* Override nav-section-title for all menus to ensure consistent positioning */
.nav-section-title {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid #3a4a5c;
    margin-bottom: 10px;
    background: rgba(255, 75, 0, 0.1);
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.nav-section-title .nav-icon {
    font-size: 1.5rem;
    margin-right: 12px;
    vertical-align: middle;
    width: 20px;
    text-align: center;
}

/* Navigation subtitle */
.nav-subtitle {
    padding: 10px 20px 5px;
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Nested navigation items */
.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: #b8c5d1;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.nav-link:hover {
    background: #3a4a5c;
    color: white;
}

.nav-link.active {
    background: #ff4b00;
    color: white;
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    margin-right: 10px;
    text-align: center;
    font-size: 14px;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}