/* Main Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
}

.app-layout {
    display: flex;
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Sidebar collapsed state */
.app-layout.sidebar-collapsed .sidebar {
    width: 46px;
}

.app-layout.sidebar-collapsed .sidebar-header h2,
.app-layout.sidebar-collapsed .nav-item span,
.app-layout.sidebar-collapsed .nav-dropdown-toggle span,
.app-layout.sidebar-collapsed .dropdown-arrow,
.app-layout.sidebar-collapsed .nav-user .user-name,
.app-layout.sidebar-collapsed .nav-dropdown-menu {
    display: none;
}

.app-layout.sidebar-collapsed .sidebar-header {
    padding: 20px 10px;
    text-align: center;
}

.app-layout.sidebar-collapsed .nav-item,
.app-layout.sidebar-collapsed .nav-dropdown-toggle {
    justify-content: center;
    padding: 12px;
}

.app-layout.sidebar-collapsed .nav-dropdown-menu {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 180px;
    background: #34495e;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
}

.app-layout.sidebar-collapsed .nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}

.app-layout.sidebar-collapsed .main-content {
    flex: 1;
    margin-left: 70px;
}

/* Sidebar toggler button */
.sidebar-toggler {
    position: fixed;
    left: 200px;
    top: 10px;
    z-index: 1001;
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-toggler:hover {
    background: #f8f9fa;
}

.sidebar-toggler-icon {
    display: block;
    width: 18px;
    height: 2px;
    background: #333;
    position: relative;
}

.sidebar-toggler-icon::before,
.sidebar-toggler-icon::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: #333;
    left: 0;
}

.sidebar-toggler-icon::before {
    top: -6px;
}

.sidebar-toggler-icon::after {
    bottom: -6px;
}

/* Collapsed state for toggler */
.app-layout.sidebar-collapsed .sidebar-toggler {
    left: 70px;
}

:root {
    --primary-color: #FF971D;
    --primary-dark: #e6860a;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    color: white;
    margin: 0;
    font-size: 24px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    justify-content: start !important;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: #667eea;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 10px 20px;
}

.nav-user {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.nav-user .user-name {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

/* Dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    justify-content: start !important;
}

.dropdown-arrow {
    transition: transform 0.2s;
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    display: none;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    margin: 4px 10px;
    overflow: hidden;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 36px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-dropdown-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-dropdown-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    width: calc(100% - 260px);
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    color: #333;
    font-size: 28px;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

h1, h2, h3, h4 {
    color: #333;
    margin-bottom: 20px;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-title h1 {
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Button Styles */
.btn {
    --cui-btn-padding-x: 0.75rem;
    --cui-btn-padding-y: 0.375rem;
    --cui-btn-font-size: 1rem;
    --cui-btn-font-weight: 400;
    --cui-btn-line-height: 1.5;
    --cui-btn-color: var(--cui-body-color);
    --cui-btn-bg: transparent;
    --cui-btn-border-width: var(--cui-border-width);
    --cui-btn-border-color: transparent;
    --cui-btn-border-radius: var(--cui-border-radius);
    --cui-btn-hover-border-color: transparent;
    --cui-btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(8, 10, 12, 0.075);
    --cui-btn-disabled-opacity: 0.65;
    --cui-btn-focus-box-shadow: 0 0 0 0.25rem rgba(var(--cui-btn-focus-shadow-rgb), .5);
    display: inline-block;
    padding: var(--cui-btn-padding-y) var(--cui-btn-padding-x);
    font-family: var(--cui-btn-font-family);
    font-size: var(--cui-btn-font-size);
    font-weight: var(--cui-btn-font-weight);
    line-height: var(--cui-btn-line-height);
    color: var(--cui-btn-color);
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    border: 1px solid var(--cui-btn-border-color);
    border-radius: 5px;
    background-color: var(--cui-btn-bg);
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary { background: #FF971D; color: white; }
.btn-secondary { background: #6c757d; color: white; }
.btn-danger { background: #dc3545; color: white; }
.btn-success { background: #28a745; color: white; }
.btn-warning { background: #ffc107; color: #333; }
.btn-info { background: #17a2b8; color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-outline-secondary {
    --cui-btn-color: #6b7785;
    --cui-btn-border-color: #6b7785;
    --cui-btn-hover-color: #fff;
    --cui-btn-hover-bg: #6b7785;
    --cui-btn-hover-border-color: #6b7785;
    --cui-btn-focus-shadow-rgb: 107, 119, 133;
    --cui-btn-active-color: #fff;
    --cui-btn-active-bg: #6b7785;
    --cui-btn-active-border-color: #6b7785;
    --cui-btn-active-shadow: inset 0 3px 5px rgba(8, 10, 12, 0.125);
    --cui-btn-disabled-color: #6b7785;
    --cui-btn-disabled-bg: transparent;
    --cui-btn-disabled-border-color: #6b7785;
    --cui-gradient: none;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

tr:hover {
    background: #f8f9fa;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-content.large {
    max-width: 700px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

/* Tabs Styles */
.tabs {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s;
}

.tab:hover {
    color: #007bff;
}

.tab.active {
    border-bottom-color: #007bff;
    color: #007bff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary { background: #007bff; color: white; }
.badge-secondary { background: #6c757d; color: white; }
.badge-success { background: #28a745; color: white; }
.badge-danger { background: #dc3545; color: white; }
.badge-warning { background: #ffc107; color: #333; }
.badge-info { background: #17a2b8; color: white; }

/* Actions */
.actions {
    display: flex;
    gap: 5px;
}

/* User List */
.user-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}

.user-item:last-child {
    border-bottom: none;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-weight: 500;
}

.user-email {
    font-size: 12px;
    color: #6c757d;
}

/* Permission Grid */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.permission-item {
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.permission-item:hover {
    background: #f8f9fa;
}

.permission-item label {
    flex: 1;
    cursor: pointer;
    margin: 0;
}

.block-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.block-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-item label {
    cursor: pointer;
    margin: 0;
}

/* Info Box */
.info-box {
    padding: 15px;
    background: #e7f3ff;
    border-left: 4px solid #007bff;
    margin-bottom: 20px;
    border-radius: 0 4px 4px 0;
}

.info-box.success {
    background: #d4edda;
    border-left-color: #28a745;
}

.info-box.warning {
    background: #fff3cd;
    border-left-color: #ffc107;
}

.info-box.danger {
    background: #f8d7da;
    border-left-color: #dc3545;
}

/* Alert Styles */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.empty-state p {
    margin-bottom: 15px;
}

/* Auth Page Styles */
.auth-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 10px;
}

.auth-subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    font-size: 14px;
}

.auth-container input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.auth-container input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-container button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.auth-container button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.auth-message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.auth-message.error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
    display: block;
}

.auth-message.success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
    display: block;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Products Page Styles */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    display: flex;
    gap: 10px;
}

.search-box input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 250px;
    font-size: 14px;
}

/* Products Table */
.products-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.products-table th,
.products-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.products-table th {
    font-weight: 600;
}

.products-table tr:hover {
    background: #f8f9fa;
}

.products-table tr:last-child td {
    border-bottom: none;
}

.actions-cell {
    white-space: nowrap;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: #f0f0f0;
}

.icon-edit {
    color: #667eea;
}

.icon-edit:hover {
    background-color: #e8ecff;
}

.icon-delete {
    color: #dc3545;
}

.icon-delete:hover {
    background-color: #ffe8ea;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.product-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.product-price {
    font-size: 24px;
    font-weight: 700;
    color: #27ae60;
}

.product-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.product-quantity {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.product-quantity span {
    font-weight: 600;
    color: #333;
}

.product-actions {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.product-actions .btn {
    flex: 1;
    text-align: center;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.no-products {
    text-align: center;
    padding: 50px;
    color: #666;
}

.login-prompt {
    text-align: center;
    padding: 50px;
}

.login-prompt h2 {
    color: #333;
    margin-bottom: 15px;
}

.login-prompt p {
    color: #666;
    margin-bottom: 20px;
}
.sidebar-toggler::before , .sidebar-toggler:hover::before , .sidebar-toggler:focus::before{
    background: #fff;
}