/* Modern Design System */
:root {
    /* Colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #f1f5f9;

    --border-color: #e2e8f0;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-base: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition-base);
}

a:hover {
    color: var(--primary-hover);
}

ul {
    list-style: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--space-md);
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.mb-3 {
    margin-bottom: var(--space-md);
}

.mt-3 {
    margin-top: var(--space-md);
}

.p-4 {
    padding: var(--space-lg);
}

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-base);
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-main);
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition-base);
}

.form-control:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.875rem;
}

/* Login Page Specifics */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-logo {
    width: 80px;
    height: auto;
    margin-bottom: var(--space-md);
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-light);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

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

.sidebar-nav {
    padding: var(--space-md) 0;
    flex: 1;
}

.nav-item {
    display: block;
    padding: var(--space-sm) var(--space-lg);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    transition: var(--transition-base);
}

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

.nav-item i {
    margin-right: var(--space-sm);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.topbar {
    height: 64px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
}

.content-wrapper {
    padding: var(--space-lg);
    flex: 1;
    overflow-y: auto;
}

/* Table Styles */
.table-container {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.813rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.table .stt {
    width: 60px;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
}

.table .code-badge {
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.table .machine-code {
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.table .machine-code.active {
    color: var(--success);
    font-weight: 500;
}

.stats-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.2);
}

.stats-bar .stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-bar .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stats-bar .stat-label {
    opacity: 0.9;
    font-size: 0.875rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Pagination */
.pagination {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-md);
    justify-content: center;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.875rem;
}

.pagination a:hover,
.pagination a.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.5rem;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.sidebar-overlay.show {
    display: block;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s ease-in-out;
    }

    .sidebar.show {
        left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .main-content {
        width: 100%;
    }

    .topbar {
        padding: 0 1rem;
    }

    .topbar h4 {
        font-size: 1rem;
    }

    .content-wrapper {
        padding: 1rem;
    }

    .d-flex.justify-between {
        flex-direction: column;
        gap: 1rem;
    }

    .search-box {
        width: 100% !important;
    }

    .table-container {
        overflow-x: auto;
    }

    .table {
        min-width: 600px;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.813rem;
    }

    .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

    .pagination {
        flex-wrap: wrap;
    }

    .login-card {
        margin: 1rem;
        padding: 1.5rem;
    }

    .card.p-4 {
        padding: 1rem;
    }
}