:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #06b6d4;
    --gray-light: #f8fafc;
    --gray-medium: #64748b;
    --gray-dark: #1e293b;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8fafc;
    color: var(--gray-dark);
    line-height: 1.6;
}

/* Login Page Styles */
.login-page {
    /*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 40px;
    text-align: center;
}

.login-header .logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-header h2 {
    color: var(--gray-dark);
    margin-bottom: 30px;
    font-weight: 600;
}

/* Admin Layout */
.admin-page {
    background: #f8fafc;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--gray-medium);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.sidebar-nav .nav-link:hover {
    background: #f8fafc;
    color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
    background: #eff6ff;
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
}

/*.sidebar:not(.open)*/

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 15px 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--gray-medium);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.sidebar-toggle:hover {
    background: #f8fafc;
}

.user-dropdown {
    position: relative;
}

.user-button {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.user-button:hover {
    background: #f8fafc;
}

.user-info {
    text-align: right;
}

.user-name {
    display: block;
    font-weight: 600;
    color: var(--gray-dark);
}

.user-role {
    display: block;
    font-size: 12px;
    color: var(--gray-medium);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-width: 200px;
    z-index: 1001;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--gray-dark);
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background: #f8fafc;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 30px;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-dark);
    margin-bottom: 4px;
}

.page-header p {
    color: var(--gray-medium);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.stat-icon.blue { background: var(--primary-color); }
.stat-icon.green { background: var(--success-color); }
.stat-icon.orange { background: var(--warning-color); }
.stat-icon.purple { background: #8b5cf6; }

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-dark);
}

.stat-label {
    color: var(--gray-medium);
    font-size: 14px;
}

/* Cards */
.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-dark);
}

.card-body {
    padding: 24px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-dark);
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-medium);
}

.input-group input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row.form-horizontal-inputs{
    display: flex;
    flex-wrap: wrap;
}

    .form-row.form-horizontal-inputs input[type="radio"]{
        margin-right: 6px;
    }

.admin-page .form-group textarea,
.admin-page .form-group select,
.admin-page .form-group input:not([type="radio"]):not([type="checkbox"]) {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group textarea:focus,
.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-danger {
    color: var(--error-color) !important;
    border-color: var(--error-color) !important;
}

.btn-danger:hover {
    background: var(--error-color) !important;
    color: white !important;
}

.btn-qr {
    background: var(--info-color);
    color: white;
    border: 1px solid var(--info-color);
}

.btn-qr:hover {
    background: #0891b2;
}

/* Table */
.table-responsive, .table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    font-size: 13px;
}

.table th {
    font-weight: 600;
    color: var(--gray-dark);
    background: #f8fafc;
}

.table td {
    color: var(--gray-medium);
}

.mono {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

/* Endpoint specific styles */
.status-on { 
    color: var(--success-color); 
    font-weight: 600; 
}

.status-off { 
    color: var(--error-color); 
    font-weight: 600; 
}

.endpoint-code { 
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #f8fafc;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.text-muted {
    color: var(--gray-medium) !important;
    font-style: italic;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.badge-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--gray-medium);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.alert-close {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-medium);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--gray-medium);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f8fafc;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
        transition: margin-left 0.3s ease;
    }
    
    .sidebar.open {
        margin-left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .content-area {
        padding: 20px;
    }
    
    .top-header {
        padding: 0 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
}

/* Error page styles */
.error-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.error-container {
    text-align: center;
    color: white;
    max-width: 500px;
}

.error-code {
    font-size: 120px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 20px;
    opacity: 0.9;
}

.error-title {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 16px;
}

.error-message {
    font-size: 18px;
    margin-bottom: 40px;
    opacity: 0.8;
    line-height: 1.5;
}

.error-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.error-page .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.error-page .btn-primary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.error-page .btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.error-page .btn-outline {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.error-page .btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}




.table td.actions > div{
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.table .btn-sm {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}


.btn-primary.btn-sm {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.btn-primary.btn-sm:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-primary.btn-sm:disabled {
    background: #cbd5e1;
    border-color: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}


.table .btn-sm[title] {
    position: relative;
}

.table .btn-sm[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
}

.table .btn-sm[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
}


@media (max-width: 768px) {
    .table td.actions > div{
        flex-direction: column;
        align-items: stretch;
        gap: 4px !important;
    }
    
    .table .btn-sm {
        min-width: auto;
        width: 100%;
        justify-content: flex-start;
        padding: 6px 12px;
    }
    
    .table .btn-sm i {
        margin-right: 6px;
    }
    
    .table .btn-sm[title]:hover::after {
        display: none; /* Hide tooltips on mobile */
    }
}


/* Endpoint specific links */
.service-type-link,
.pricing-rules-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.service-type-link:hover,
.pricing-rules-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.pricing-rules-link .badge {
    transition: all 0.2s ease;
}

.pricing-rules-link:hover .badge {
    background: var(--primary-color);
    color: white;
}

/* Make readonly inputs more obvious */
input[readonly] {
    background-color: #f8f9fa !important;
    color: var(--gray-medium) !important;
    cursor: not-allowed;
}

input[readonly]:focus {
    box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.1) !important;
    border-color: var(--gray-medium) !important;
}

/* Endpoint table improvements */
.table td.actions .btn-sm {
    white-space: nowrap;
}

.endpoint-code {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

/* Better spacing for endpoint table */
.table-container {
    overflow-x: auto;
    margin: -1px; /* Prevent scrollbar from creating gap */
}

.table-container .table {
    min-width: 1200px; /* Ensure table doesn't get too cramped */
}

@media (max-width: 1200px) {
    .table-container .table th,
    .table-container .table td {
        font-size: 12px;
        padding: 8px 6px;
    }
    
    .service-type-link,
    .pricing-rules-link {
        font-size: 11px;
    }
    
    .badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* Profile page styles */
.profile-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    align-items: start;
}

.profile-avatar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.avatar-circle {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.profile-basic h4 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: var(--gray-dark);
}

.profile-basic .role-badge {
    margin: 0 0 8px 0;
}

.profile-basic .email {
    margin: 0;
    color: var(--gray-medium);
    font-size: 14px;
}

.profile-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
    color: var(--gray-medium);
}

.stat-value {
    color: var(--gray-dark);
    font-weight: 600;
    text-align: right;
}

.stat-value small {
    display: block;
    font-weight: normal;
    color: var(--gray-medium);
    font-size: 12px;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section h4 {
    margin: 0 0 16px 0;
    color: var(--gray-dark);
    font-size: 18px;
}

.form-section p.text-muted {
    margin: 0 0 16px 0;
    color: var(--gray-medium);
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    padding-top: 20px;
}

@media (max-width: 768px) {
    .profile-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .profile-avatar {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .stat-value {
        text-align: left;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

.locations-checkboxes{
    display: flex;
    gap: 5px 15px;
    align-items: center;
    flex-wrap: wrap;
}

    .locations-checkboxes label.location-item{
        display: inline-flex;
        align-items: center;
        gap: 5px;
        cursor: pointer;
    }

    .locations-checkboxes label.location-item input{
        
    }