* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Role-specific body backgrounds */
body.admin-theme {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 50%, #c44569 100%);
}

body.pensyarah-theme {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 50%, #2c7873 100%);
}

body.pelajar-theme {
    background: linear-gradient(135deg, #95e1d3 0%, #6bcf7f 50%, #4facfe 100%);
}

.container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
    max-width: 450px;
    width: 100%;
}

.login-container {
    text-align: center;
}

h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

select {
    background-color: white;
    cursor: pointer;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button[type="submit"],
.btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

button[type="submit"]:hover,
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button[type="submit"]:active,
.btn:active {
    transform: translateY(0);
}

/* Dashboard Styles */
.dashboard-container {
    max-width: 800px;
    width: 100%;
}

.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px 15px 0 0;
    text-align: center;
}

/* Role-specific dashboard headers */
.admin-theme .dashboard-header {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 50%, #c44569 100%);
}

.pensyarah-theme .dashboard-header {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 50%, #2c7873 100%);
}

.pelajar-theme .dashboard-header {
    background: linear-gradient(135deg, #95e1d3 0%, #6bcf7f 50%, #4facfe 100%);
}

.dashboard-header h2 {
    color: white;
    margin-bottom: 10px;
}

.dashboard-content {
    background: white;
    padding: 40px;
    border-radius: 0 0 15px 15px;
}

.user-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    border-left: 4px solid #667eea;
}

/* Role-specific user info borders */
.admin-theme .user-info {
    border-left: 4px solid #ff6b6b;
    background: #fff5f5;
}

.pensyarah-theme .user-info {
    border-left: 4px solid #4ecdc4;
    background: #f0fdfa;
}

.pelajar-theme .user-info {
    border-left: 4px solid #95e1d3;
    background: #f0fdf4;
}

.user-info p {
    color: #555;
    font-size: 16px;
    margin-bottom: 10px;
}

.user-info strong {
    color: #333;
    font-weight: 600;
}

.role-badge {
    display: inline-block;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 10px;
}

.role-admin {
    background: #ff6b6b;
    color: white;
}

.role-pensyarah {
    background: #4ecdc4;
    color: white;
}

.role-pelajar {
    background: #95e1d3;
    color: white;
}

.logout-btn {
    display: inline-block;
    padding: 12px 30px;
    background: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
}

.logout-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

/* Role-specific logout buttons */
.admin-theme .logout-btn {
    background: #ff4757;
}

.admin-theme .logout-btn:hover {
    background: #ee5a6f;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.pensyarah-theme .logout-btn {
    background: #2c7873;
}

.pensyarah-theme .logout-btn:hover {
    background: #44a08d;
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

.pelajar-theme .logout-btn {
    background: #4facfe;
}

.pelajar-theme .logout-btn:hover {
    background: #6bcf7f;
    box-shadow: 0 5px 15px rgba(149, 225, 211, 0.4);
}

/* Error Messages */
.error-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.error-message {
    background: #fff3cd;
    border: 2px solid #ffc107;
    color: #856404;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 16px;
}

.error-link {
    display: inline-block;
    padding: 10px 25px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.error-link:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

/* Access Denied */
.access-denied {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.access-denied h2 {
    color: #dc3545;
    margin-bottom: 20px;
}

.access-denied p {
    color: #555;
    font-size: 16px;
    margin-bottom: 20px;
}

/* CRUD Styles */
.crud-section {
    margin-top: 30px;
}

.crud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.crud-header h3 {
    color: #333;
    font-size: 22px;
    margin: 0;
}

.btn-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.btn-edit {
    padding: 6px 12px;
    background: #4ecdc4;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin-right: 5px;
}

.btn-edit:hover {
    background: #44a08d;
    transform: translateY(-1px);
}

.btn-delete {
    padding: 6px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.users-table thead {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.users-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
}

.users-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    color: #555;
}

.users-table tbody tr:hover {
    background: #fff5f5;
}

.users-table tbody tr:last-child td {
    border-bottom: none;
}

.role-badge-table {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge-table.admin {
    background: #ff6b6b;
    color: white;
}

.role-badge-table.pensyarah {
    background: #4ecdc4;
    color: white;
}

.role-badge-table.pelajar {
    background: #95e1d3;
    color: white;
}

.form-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.form-modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    color: #333;
    margin: 0;
    font-size: 24px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #ff6b6b;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.success-message {
    background: #d4edda;
    border: 2px solid #28a745;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 600px) {
    .container,
    .dashboard-container,
    .error-container,
    .access-denied {
        padding: 25px;
    }
    
    h2 {
        font-size: 24px;
    }
    
    .users-table {
        font-size: 12px;
    }
    
    .users-table th,
    .users-table td {
        padding: 8px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .crud-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}
