/* main.css - Common styles for all pages */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --success-color: #4cc9f0;
    --danger-color: #f72585;
    --warning-color: #ff9e00;
    --info-color: #7209b7;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 250px;
    --header-height: 70px;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    display: flex;
    background-color: #f5f7fb;
    color: var(--dark-color);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 25px 0;
    height: 100vh;
    position: fixed;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transition: var(--transition);
}

.logo {
    padding: 0 25px 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 30px;
}

.logo i {
    font-size: 28px;
    color: #4cc9f0;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
    border-left: 4px solid transparent;
    margin-bottom: 5px;
}

.nav-item a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 4px solid #4cc9f0;
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left: 4px solid #4cc9f0;
}

.nav-item i {
    font-size: 20px;
    width: 24px;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    transition: var(--transition);
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e5f0;
}

.header h1 {
    color: var(--secondary-color);
    font-size: 28px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--success-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

/* Common Section Styles */
.section {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.section-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary-color);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary-color);
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.btn {
    padding: 12px 24px;
    border-radius: var(--border-radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #e9ecef;
    color: var(--dark-color);
}

.btn-secondary:hover {
    background-color: #dee2e6;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* Search and Filter */
.search-filter {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.filter-select {
    width: 200px;
}

/* Data Table */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: var(--border-radius);
    border: 1px solid #e0e5f0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: #f8f9fa;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--secondary-color);
    border-bottom: 2px solid #e0e5f0;
}

td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

.key-id {
    font-weight: 600;
    color: var(--primary-color);
    font-family: monospace;
}

.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status.available {
    background-color: rgba(76, 201, 240, 0.15);
    color: var(--success-color);
}

.status.used {
    background-color: rgba(247, 37, 133, 0.15);
    color: var(--danger-color);
}

.status.expired {
    background-color: rgba(255, 158, 0, 0.15);
    color: var(--warning-color);
}

.action-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    margin: 2px;
}

.action-btn.view {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.action-btn.edit {
    background-color: rgba(76, 201, 240, 0.1);
    color: var(--success-color);
}

.action-btn.delete {
    background-color: rgba(247, 37, 133, 0.1);
    color: var(--danger-color);
}

.action-btn:hover {
    transform: translateY(-2px);
}

/* Alert Messages */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: rgba(76, 201, 240, 0.1);
    border-left: 4px solid var(--success-color);
    color: #155724;
}

.alert-error {
    background-color: rgba(247, 37, 133, 0.1);
    border-left: 4px solid var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background-color: rgba(255, 158, 0, 0.1);
    border-left: 4px solid var(--warning-color);
    color: #856404;
}

/* Toggle Sidebar Button */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* Responsive Design */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
    }
    
    .logo span, .nav-item span {
        display: none;
    }
    
    .logo {
        justify-content: center;
        padding: 0 0 30px;
    }
    
    .nav-item {
        justify-content: center;
        padding: 20px 0;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }
    
    .search-filter {
        flex-direction: column;
    }
    
    .filter-select, .search-box {
        width: 100%;
    }
}

/* Modal Styles - Add to main.css if not already present */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e5f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--secondary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e5f0;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}