/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Auth Page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-box h1 {
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    transition: width 0.3s ease;
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 10px;
}

.sidebar.collapsed .sidebar-header h2 {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-nav a {
    padding: 12px 10px;
    text-align: center;
    position: relative;
    justify-content: center;
}

.sidebar.collapsed .sidebar-nav a span {
    display: none;
}

.sidebar.collapsed .sidebar-toggle .toggle-icon {
    transform: rotate(180deg);
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #1a252f;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #34495e;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #4a5f7a;
}

.sidebar-header {
    padding: 20px;
    background: #1a252f;
    border-bottom: 1px solid #34495e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 20px;
    border-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: #34495e;
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background 0.2s, padding 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav a span {
    display: inline-block;
    transition: opacity 0.3s ease;
}

/* Submenu Styles */
.sidebar-menu-item {
    position: relative;
}

.sidebar-menu-item > a {
    position: relative;
}

.sidebar-menu-item > a::after {
    content: '▼';
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.3s ease;
}

.sidebar-menu-item.open > a::after {
    transform: rotate(180deg);
}

.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #1a252f;
}

.sidebar-menu-item.open > .sidebar-submenu {
    max-height: 500px;
}

.sidebar-submenu a {
    padding-left: 40px;
    font-size: 13px;
}

.sidebar-submenu a:hover {
    background: #2c3e50;
}

.sidebar-submenu a.active {
    background: #3498db;
    color: white;
}

.sidebar-menu-item.open > a {
    background: #34495e;
    color: white;
}

.sidebar-menu-label {
    padding: 10px 20px;
    color: #95a5a6;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 20px;
    border-top: 1px solid #34495e;
    padding-top: 20px;
}

/* Collapsed sidebar submenu */
.sidebar.collapsed .sidebar-menu-item > a::after {
    display: none;
}

.sidebar.collapsed .sidebar-submenu {
    display: none !important;
}

.sidebar.collapsed .sidebar-menu-label {
    display: none;
}

.sidebar.collapsed .sidebar-menu-item > a {
    cursor: default;
}

.sidebar-nav a:hover {
    background: #34495e;
}

.sidebar-nav a.active {
    background: #3498db;
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-left: 250px; /* Offset for fixed sidebar */
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Main Content when sidebar is collapsed - handled by JavaScript */

.topbar {
    background: white;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.topbar h1 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    color: #666;
}

.content-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn:hover {
    background: #2980b9;
}

.btn-primary {
    background: #27ae60;
}

.btn-primary:hover {
    background: #229954;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Number input specific styles */
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    text-align: right;
    font-family: 'Courier New', monospace;
}

/* Number input hover and focus states */
input[type="number"]:hover {
    border-color: #3498db;
}

input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Tables */
.data-table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    margin-top: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.badge-active {
    background: #d4edda;
    color: #155724;
}

.badge-inactive {
    background: #f8d7da;
    color: #721c24;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    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;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #333;
}

/* Filters */
.filters {
    background: white;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filters form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filters input,
.filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 5px;
    margin-top: 20px;
    justify-content: center;
}

.pagination .btn {
    min-width: 40px;
    text-align: center;
}

.pagination .btn.active {
    background: #27ae60;
}

/* Dashboard */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.stat-number {
    font-size: 32px;
    font-weight: 600;
    color: #333;
}

.dashboard-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dashboard-section h2 {
    margin-bottom: 15px;
    font-size: 20px;
    color: #333;
}

/* Detail View */
.detail-view {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.detail-row {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row strong {
    display: inline-block;
    width: 150px;
    color: #666;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    background: #f5f5f5;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.tab-btn:hover {
    background: #e9e9e9;
}

.tab-btn.active {
    background: white;
    border-bottom-color: #3498db;
    color: #3498db;
    font-weight: 600;
}

.tab-content {
    min-height: 300px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
    padding: 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal form {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-radius: 0 0 8px 8px;
}

/* DataTables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table_wrapper {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters form {
        flex-direction: column;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Code */
code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* Fieldset */
fieldset {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

legend {
    padding: 0 10px;
    font-weight: 600;
    color: #333;
}

fieldset div {
    margin: 8px 0;
}

fieldset input[type="checkbox"] {
    margin-right: 8px;
}

fieldset label {
    font-weight: normal;
}

fieldset small {
    color: #666;
    font-size: 12px;
}

